Docker Community Forums

Share and learn in the Docker community.

Problem with MYSQL connection in container?

Hi there, I need some help:

This simple docker config is running fine on my local machine: https://gist.github.com/solars/e54685a719ec06973898e0bf00d0f52e

But if I run it under rancherOS keep getting the can’t connect to MYSQL error (see snippet).

Does anyone know what could cause this or how I could debug it?

Thank you very much,
Christoph

Did you check the container log for additional information? docker container logs CONTAINER_ID
Next I would check these NFS mounts. For example mount them into a simple Alpine container and try to read from and write to them. If we search other forums, there are dozens of questions around RancherOS and NFS.

1 Like

Thanks for the reply - I only got the log output that I pasted, from the container.
I will check if it’s some kind of NFS issue, thanks for the hint.

As far as I remember it’s possible for MYSQL to configure it to not use the socket, but I don’t remember how.
In this case I could probably change the image: https://gitlab.com/MiGoller/ShinobiDocker

You connect to MySQL running on localhost, so to use the socket is fine. The error message means the db isn’t running at all.
Now when I look at your error message again, it is created from mysqladmin. We find this command in this loop in docker-entrypoint.sh. So either the 5 seconds on line 42 are not enough or the db isn’t able to start up. Unfortunately we don’t get its log to STDOUT.