网站建设资讯详细

解决docker启动容器报错: iptables: No chain/target/match by that name

发表日期:2024-08-28 23:57:13   作者来源:水沐教育科技   浏览:535       

解决docker启动容器报错: iptables: No chain/target/match by that name

重点看iptables: No chain/target/match by that name.

和iptables有关

使用service docker restart 或 systemctlrestart docker 能够正常启动容器

或者关闭网关(防火墙

systemctl stop firewalld

systemctl stop iptables

 

再次启动如下命令能够正常启动:

docker run --detach --hostname 192.168.1.4 --publish 8443:443 --publish 8080:80 --publish 8022:22 --name gitlab10.8.3 --restart always --volume /data/web/env/git/gitlab10.8.3/config:/etc/gitlab --volume /data/web/env/git/gitlab10.8.3/logs:/var/log/gitlab --volume /data/web/env/git/gitlab10.8.3/data:/var/opt/gitlab --privileged=true gitlab/gitlab-ce:10.8.3-ce.0

 

整体操作如下:

[root@localhost ~]# docker run --detach   --hostname 192.168.1.4   --publish 8443:443 --publish 8080:80 --publish 8022:22   --name gitlab10.8.3   --restart always   --volume /data/web/env/git/gitlab10.8.3/config:/etc/gitlab   --volume /data/web/env/git/gitlab10.8.3/logs:/var/log/gitlab   --volume /data/web/env/git/gitlab10.8.3/data:/var/opt/gitlab   --privileged=true   gitlab/gitlab-ce:10.8.3-ce.0
a2438950ac06c5cb5cb135a5e0d3523c0154f42c8c12f104eea6a93c9bcd8b89
docker: Error response from daemon: driver failed programming external connectivity on endpoint gitlab10.8.3 (4b1366f030015cda3f865c558134439e286f2aa1c94575647197960f4ec4c990):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8443 -j DNAT --to-destination 172.17.0.2:443 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE          COMMAND                   CREATED        STATUS         PORTS                                                                                                                                      NAMES
cc6eb3637cdb   01887177def0   "docker-entrypoint.s…"   2 months ago   Up 4 seconds   4369/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp   rabbitmq
cca3bb53bec4   redis:6.0.8    "docker-entrypoint.s…"   2 months ago   Up 4 seconds   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                                                                  redis
[root@localhost ~]# docker run --detach   --hostname 192.168.1.4   --publish 8443:443 --publish 8080:80 --publish 8022:22   --name gitlab10.8.3   --restart always   --volume /data/web/env/git/gitlab10.8.3/config:/etc/gitlab   --volume /data/web/env/git/gitlab10.8.3/logs:/var/log/gitlab   --volume /data/web/env/git/gitlab10.8.3/data:/var/opt/gitlab   --privileged=true   gitlab/gitlab-ce:10.8.3-ce.0
docker: Error response from daemon: Conflict. The container name "/gitlab10.8.3" is already in use by container "a2438950ac06c5cb5cb135a5e0d3523c0154f42c8c12f104eea6a93c9bcd8b89". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
[root@localhost ~]# docker remove a2438950ac06c5cb5cb135a5e0d3523c0154f42c8c12f104eea6a93c9bcd8b89
a2438950ac06c5cb5cb135a5e0d3523c0154f42c8c12f104eea6a93c9bcd8b89
[root@localhost ~]# docker run --detach   --hostname 192.168.1.4   --publish 8443:443 --publish 8080:80 --publish 8022:22   --name gitlab10.8.3   --restart always   --volume /data/web/env/git/gitlab10.8.3/config:/etc/gitlab   --volume /data/web/env/git/gitlab10.8.3/logs:/var/log/gitlab   --volume /data/web/env/git/gitlab10.8.3/data:/var/opt/gitlab   --privileged=true   gitlab/gitlab-ce:10.8.3-ce.0
6abb58c30b642bbdb86226612458228c977551918b23250dc1d5fef076f3bef0
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE                          COMMAND                   CREATED         STATUS                            PORTS                                                                                                                                      NAMES
6abb58c30b64   gitlab/gitlab-ce:10.8.3-ce.0   "/assets/wrapper"         7 seconds ago   Up 4 seconds (health: starting)   0.0.0.0:8022->22/tcp, :::8022->22/tcp, 0.0.0.0:8080->80/tcp, :::8080->80/tcp, 0.0.0.0:8443->443/tcp, :::8443->443/tcp                      gitlab10.8.3
cc6eb3637cdb   01887177def0                   "docker-entrypoint.s…"   2 months ago    Up 30 seconds                     4369/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp   rabbitmq
cca3bb53bec4   redis:6.0.8                    "docker-entrypoint.s…"   2 months ago    Up 30 seconds                     0.0.0.0:6379->6379/tcp, :::6379->6379/tcp