Can't connect to MySQL server: Connection refused

@dduportal. Thanks for the static/dynamic clarifications. In my scenario, Traefik is running on a Windows Server host (outside any container) and the MySQL (mysqld) server is in a container.

Maybe it's the way Docker works on Windows, but I am able to reach my container's services (mysqld) from the host simply by using the exposed port (3307), this is why I can refer to it by using 127.0.0.1:3307.

I have made a few more tests and I finally got it to work with the configuration as shown, the problem was an upstream (not on my host machine) firewall rule that blocked port 3306. Things can get confusing when multiple firewalls must be set...

Thanks for the help.