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

WJ
Release: 2020-06-08 17:06:45
Original
3160 people have browsed it

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:

[root @kvm66 ~]# docker run -d -p 20024:22 centos-ssh /usr/sbin/sshd -D

##63f7d417b2dbf0026e0bb6da631ad64bf6ece14a8fd05f519d54892fe5bd5447

Error 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.

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 myself

Solution:

Submit the image of the container that needs to be saved

[

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 docker0
Copy after login

Restart docker after that

[root@kvm66 ~]# /etc/init.d/docker status
Copy after login

Start the container for port mapping

Related references:

docker tutorial



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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template