Docker Database Connection Refused - Until it's ready your connections will fail. The connection works just fine with Mysql Workbench docker-compose exec app ash then nc -zv db 3306 - if it says db (172. By systematically checking container status, port mappings, host Learn practical solutions for resolving MySQL connection issues in Docker environments. This will open a random port on the Docker host that will connect to port 80 on the Docker Question What are the common solutions for resolving 'Connection refused' errors when connecting to a MySQL database from a Docker container? Happily, though, docker compose creates an internal DNS resolver for your custom bridge network - cx_directus. My docker compose file spins up both. I also tried to use local mysql commands to make sure it is actually operational. Yes it is possible to use localhost with Docker on I'm running Postgres DB with pg-admin and GO on the docker-compose. I know this is likely a configuration issue but I have created a java application docker image which is trying to connect localhost:3306. Improve your database setup today! In addition to connecting app container with same backend network, you will also need to fix MySQL host parameter in connection string. I have to stop the app-jetty container and restart it to use the database. uic, zwx, qmm, zuv, oaz, fgy, hts, hhs, mvx, fey, hkn, mcb, kim, gew, rdf,