原始镜像如下:
REPOSITORY TAG IMAGE ID CREATED SIZE xtjatswc/mycore2 v3 73ce3cd97c01 About an hour ago 1.74GB xtjatswc/mycore latest 73ce3cd97c01 About an hour ago 1.74GB microsoft/dotnet latest 521411f3b61d 4 days ago 1.73GB
用docker tag 命令修改镜像REPOSITORY、TAG后,如下
[root@localhost tmp]# docker tag xtjatswc/mycore2:v3 xtjatswc/mycore4:v4 [root@localhost tmp]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE xtjatswc/mycore2 v3 73ce3cd97c01 2 hours ago 1.74GB xtjatswc/mycore4 v4 73ce3cd97c01 2 hours ago 1.74GB xtjatswc/mycore latest 73ce3cd97c01 2 hours ago 1.74GB microsoft/dotnet latest 521411f3b61d 4 days ago 1.73GB
这里如果把xtjatswc/mycore:latest删掉的话,再运行容器xtjatswc/mycore4:v4,就会出现如下错误
[root@localhost tmp]# docker run --name myc3 -p 8081:80 -d xtjatswc/mycore WARNING: IPv4 forwarding is disabled. Networking will not work. 5a5cc306a6b36645d37fbf077f21ac91a53bf508e8e257aa74f353f761fcbfaf docker: Error response from daemon: driver failed programming external connectivity on endpoint myc3 (8cb3855574298d61130294ea5d596525099d906106bbb7be7ce427dc1ab5dcd1): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8081 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name. (exit status 1)). [root@localhost tmp]# curl http://localhost:8081 curl: (7) Failed connect to localhost:8081; 拒绝连接
原因:
docker服务启动时定义的自定义链DOCKER由于某种原因被清掉
重启docker服务及可重新生成自定义链DOCKER
[root@localhost tmp]# systemctl restart docker