简体   繁体   中英

Docker container can't be reached from another PC

I built a mysql docker container. It seems to work fine, however when I try to connect to it from a computer it wont connect to mysql. The computer is in the same lan and can connect via ssh so it's not a networking issue. I'm pretty sure it has something to do with the ports not being published or binded correctly. Any suggestions? Thank you!

The most likely suspects for your issue are:

  1. Your host firewall is set to not allow connections to MySQL (port 3306). It may be published by docker but you aren't permitting connections from outside the host.
  2. Your docker isn't publishing as part of the same network but rather as a sub-network (not likely since you can connect to ssh from the other computer)
  3. Your mysql instance is not set up to listen to remote connections. Check your my.cnf to ensure that it is isn't listening to localhost:3306.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM