Home>Article>Operation and Maintenance> What to do if the docker port is blocked
Solution to docker port failure: 1. Open the command window; 2. Execute "sysctl -w net.ipv4.ip_forward=1 sed -i "/net.ipv4.ip_forward/ s/0/1/ g"/etc/sysctl.conf" command.
The operating environment of this tutorial: ubuntu 16.04 system, Docker version 20.10.11, Dell G3 computer.
What should I do if the docker port is blocked?
Docker: The port of a normally running container suddenly becomes blocked. General check methods:
## Premise: Under normal circumstances, in the DOCKER environment we run, there may be problems with container ports being blocked. Here are some notes I have experienced and summarized to help check the problem.
sysctl -a |grep "ipv4.ip_forward" =====> net.ipv4.ip_forward = 1 cat /etc/sysctl.conf| grep "ipv4.ip_forward" =====> net.ipv4.ip_forward = 0This kind of In this case, if someone changes other parameters and then takes effect through sysctl -p, then the parameter changed by docker will be reconfigured to be consistent with the one in the /etc/sysctl.conf file , causing the port to be blocked. This Sometimes you need to restart docker to change it to 1 again. So when we install docker, we need to set this parameter to 1 first. The command to install docker is as follows:
sysctl -w net.ipv4.ip_forward=1 sed -i "/net.ipv4.ip_forward/ s/0/1/g" /etc/sysctl.confSummary In fact, all that is said is to restart iptables and restart docker. , you can solve the basic problem, haha, I talked some nonsense, but I hope I can share it with everyone Recommended learning: "
docker video tutorial"
The above is the detailed content of What to do if the docker port is blocked. For more information, please follow other related articles on the PHP Chinese website!