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:
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. . .
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:
Summary:
To sum up the above two articles, the keyword is iptables port mapping service and Docker of an association
- The first step I checked under the server service iptables
It can be seen iptables service problems can not actually shut
- Here, I guess: probably because iptables restart the server causes problems, iptables hung up port mapping will affect Docker
- How to save iptables Service
Reference: https://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7
-
OK did so to save the iptables Service
-
No problem to open the next test iptables service
-
Try the next visit still fail in iptables open state
-
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! ! !