Home >Operation and Maintenance >Docker >How to solve the problem that docker cannot perform port mapping
How to solve the problem that docker cannot perform port mapping?
Fault background:
When I started the docker container and performed port mapping today, I found an error. The port mapping could not be performed. The error was reported as follows:
Then I remembered that there was a problem with the remote connection of the server a few days ago, and I turned off the firewall myselfSolution: Submit the image of the container that needs to be saved[[root @kvm66 ~]# docker run -d -p 20024:22 centos-ssh /usr/sbin/sshd -D
##63f7d417b2dbf0026e0bb6da631ad64bf6ece14a8fd05f519d54892fe5bd5447Error response from daemon: Cannot start container 63f7d417b2dbf0026e0bb6da631ad64bf6ece14a8fd05f519d54892fe5bd5447: iptables failed: iptables -t nat -A DOCKER -p tcp -d 0/0 --dport 20024 -j DNAT --to-destination 172.17.0.24:22 ! -i docker0: iptables: No chain/target/match by that name.
root@kvm66 ~]# docker commit 688a2b65fe6e blue-zk 1e44a667d2fc0523718019f57ee9a1563d3ba9ab49a6fb840a43e9e664b37ca2 [root@kvm66 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE blue-zk latest 1e44a667d2fc 25 seconds ago 945.3 MB [root@kvm66 ~]# /etc/init.d/docker stop 停止docker: [确定] [root@kvm66 ~]# iptables -t nat -F [root@kvm66 ~]# ifconfig docker0 down [root@kvm66 ~]# brctl delbr docker0Restart docker after that
[root@kvm66 ~]# /etc/init.d/docker statusStart the container for port mappingRelated references:
The above is the detailed content of How to solve the problem that docker cannot perform port mapping. For more information, please follow other related articles on the PHP Chinese website!