After rebooting the server can not Docker container port outside the network suddenly exposed visit !!

 

Problem Description:

Server memory is not enough need to add 8G memory, plus memory need to restart the server, but after the restart Docker container starts successfully, the port mapping, that is outside the network can not access.

Looked under the normal operation of the container port is also mapped success: image

Ali cloud to mention the work order

Ali cloud to mention the work order, and people do not know what the reason, it is recommended to troubleshoot myself get caught! ! Hey. . .image

Or your own research it

google search a bit Keyword: docker restart port mapping failure

Selected under the following two articles read:

https://www.cnblogs.com/zl1991/p/10531726.html

Summary: image

https://py3.io/Docker/

Summary:

image

To sum up the above two articles, the keyword is iptables port mapping service and Docker of an association

  1. The first step I checked under the server service iptables image

It can be seen iptables service problems can not actually shut

  1. Here, I guess: probably because iptables restart the server causes problems, iptables hung up port mapping will affect Docker
  2. How to save iptables Service

Reference: https://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7

image

  1. OK did so to save the iptables Service image

  2. No problem to open the next test iptables service image

  3. Try the next visit still fail in iptables open state

  4. Re iptables closed a successful visit next try! ! ! !

to sum up:

If before Docker containers exposed port can access, when you restart the server, not the access.

Under normal service checks whether iptables,

Failed to restart iptables.service::. Unit not found appears if a similar error, then put the iptables service and then try reloading. I was so try a success! ! !

Guess you like

Origin www.cnblogs.com/yudongdong/p/10984246.html