"Connection refused" to mysql in docker

Seems like you might be dealing with something similar to what I did. If either Seafile (or seadoc or MySQL, etc) is running on docker, and the other service is running on the host machine, they will be on different networks. A docker container is somewhat like a different computer running on the same LAN. You can configure multiple docker containers to run on the same network, but I don’t think you can configure them to run on the same network as the host.

So a docker program won’t be able to connect to MySQL running on localhost because it’s running on a different network. You have to edit your my.cnf file (or 50-server.cnf if you’re using Mariadb) and set the bind address to 0.0.0.0. I tried adding multiple bind addresses, including 127.0.0.1 (localhost) and the docker IP addresses, but Mariadb wouldn’t start back up, so I just used 0.0.0.0, which lets any IP address connect. I also had to open the MySQL port on my ufw firewall.

My error was exactly the same (Errno 111), so hopefully this works for you too. This really should be documented in the server manual, because it took me forever to figure it out.