Running Metabase in docker locally and having pb with local database


New to metabase. I have a Ubuntu laptop where i a Metbase docker locally and a Mariadb database locally as well. Test purpose.
Metabase installed now and works fine , except I can NOT add a new database as a direct connection (section Next Steps in Admin) ie adding a "mysql" db localhost default port returns this:

"Could not connect to address=(host=localhost)(port=3306)(type=master) : Socket fail to connect to host:localhost, port:3306. Connection refused (Connection refused)"

I am probably nuts but I have not found tips or solutions on the FAQ. I apologise if I missed an explanation somewhere.

Note: this is how I have launched the docker:
docker run -d -p 3000:3000 --name metabase metabase/metabase

Thanks for your help.

Hi @zooce

You need to think about Docker as separate servers, so localhost in a container is the container itself.
Read more here: Cannot connect to localhost PgAdmin 4 server

Would also recommend specifying an application database, so you don't lose all data if you remove the container:

If you're unfamiliar with Docker, then use JAR instead:

1 Like