mysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on '' (111)

Hitting the following error in travis. Works fine in local environment.

Hello, there. I will start with the obvious question: Is the MySQL server running on your Docker image? In the docker build output, I see the client library and the common package being installed, but not the server.

correct. mysql server is running in the container and the port is exposed in run command

How did you confirm this?

We can enable debug feature on this repository if you wish, so you can troubleshoot the issue interactively. Please email

I am building the image myself. When I am running the same commands locally, it works like a charm.

If your statements are true, then I have no idea why you can’t connect to your MySQL server on the container.

I am waiting for travis to enable the debug option on my repo