docker运行报错docker0: iptables: No chain/target/match by that name.

转自:https://blog.csdn.net/wohaqiyi/article/details/84450562

docker运行报错docker0: iptables: No chain/target/match by that name.
  最近在一个新的服务器上装服务,没有安装iptables ,后来安装了iptables 之后,忽然发现我的docker 不能运行了。
  注意,可能别人的不行,我这个原因是,开始在新服务器上没有安装iptables ,先安装的docker ,后来才停用默认的firewall ,安装了iptables,就出现了这样的问题。其他原因,我不知道这方法可行不?先看错误:
  运行时报出了以下错误:
————————————————

启动docker服务报错
Error response from daemon: No such container: yn-userservice-30000
26126ca87430b74c3987817492cc890e72c36e2fec10d807e362a12f22365160
/usr/bin/docker-current: Error response from daemon: driver failed programming external
 connectivity on endpoint yn-userservice-30000 (5d083ef51f932ac24936713ab3bc1cece9d47feabf4a916cf5da12a4fb2a122a):
 (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 30000 -j DNAT --to-
 destination 172.17.0.2:30000 ! -i docker0: iptables: No chain/target/match by that name.

后来在网上找了下,发现解决办法很简单,如下:

1、停止docker服务

  输入如下命令停止docker服务

systemctl stop docker  或者service docker stop

停止成功的话,再输入docker ps 就会提示出下边的话:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?
2、保存 iptables

  输入如下命令:

iptables-save >  /etc/sysconfig/iptables

我发现 防火墙的配置文件/etc/sysconfig/iptables前后文件如下,当然我是看不懂了,我也就会设置个入站端口
  保存之前文件内容:

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10001 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10002 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10003 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10004 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

保存之后的文件内容:

# Generated by iptables-save v1.4.21 on Sat Nov 24 13:53:13 2018
*nat
:PREROUTING ACCEPT [261:18558]
:INPUT ACCEPT [17:969]
:OUTPUT ACCEPT [4:304]
:POSTROUTING ACCEPT [4:304]
COMMIT
# Completed on Sat Nov 24 13:53:13 2018
# Generated by iptables-save v1.4.21 on Sat Nov 24 13:53:13 2018
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1246:135222]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10001 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10002 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10003 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10004 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Sat Nov 24 13:53:13 2018
3、启动docker服务

  保存了iptables后,可以重新启动docker了。输入如下命令:

systemctl start docker 或者service docker  start
4、将docker设置为开机启动

  设置过这个就不需要再设置了

systemctl enable docker
5、启动容器

  最后启动容器,发现不再报错了。

docker start 容器id/名字

原文地址:https://www.cnblogs.com/ziye/p/11684765.html

时间: 2024-10-14 21:25:06

docker运行报错docker0: iptables: No chain/target/match by that name.的相关文章

docker0: iptables: No chain/target/match by that name错误处理

今天运行这个命令时报错 docker run -it --name Haproxy --link app1:app1 --link app2:app2 -p 6302:6301 -v ~/Projects/HAProxy:/tmp haproxy /bin/bash 报错信息: docker: Error response from daemon: failed to create endpoint Haproxy on network bridge: iptables failed: ipta

docker启动容器报"iptables No chain/target/match"

Centos 7 docker 启动grafana容器报"iptables No chain/target/match by that name" docker run -d -p 3000:3000  grafana/grafana:5.1.0   Error response from daemon: Cannot start container 565c06efde6cd4411e2596ef3d726817c58dd777bc5fd13762e0c34d86076b9e: ip

arm,iptables: No chain/target/match by that name.

最近由于项目需要,需要打开防火墙功能. 公司有 arm linux 3.0x86 linux 3.2x86 linux 2.4 的三个嵌入式.都需要打开防火墙功能. 执行“whereis iptables”命令,如果结果不为空,则说明防火墙软件已安装 # whereis iptables iptables: /sbin/iptables /usr/share/iptables /usr/share/man/man8/iptables.8.gz [email protected]:~ 9:26:5

docker运行报错

Centos上安装Docker-CE,后运行docker run hello-world报错Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 解决办法$ systemctl daemon-reload$ sudo service docker restart$ sudo service docker status (should see active

Docker Compose报错Failed to Setup IP tables

详细信息如下: [[email protected] docker-gitlab]# docker-compose up -d Creating network "docker-gitlab_bridge" with driver "bridge" ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I

appium运行报错java.net.SocketException: socket write error

这个错我调了 快两天一点头绪没有,脚本正常跑没问题,但是就是控制台输出信息报错,没法定位问题在哪.报错如图: 虽然这个报错不影响测试结果,但是本人有强迫症,一定要查出究竟: 我的尝试: 1.那天试验,服务器上的代码没问题,我本地一运行就报这个错,结果我把系统重装了(先前我查了两个小时百度加上尝试,无果) 2.今天从中午开始又开始搞起来,起初怀疑是我的io操作引起的,结果在finanly加了process.destroy();及p.getErrorStream(),close也不行, 网上查了说是

dubbo-admin-2.5.3 运行报错: Bean property 'URIType' is not writable or has an invalid

因为 jdk 是1.8的版本,和 dubbo-admin 存在兼容性问题.所以报错: Bean property 'URIType' is not writable or has an invalid 参见:https://github.com/alibaba/dubbo/issues/50 解决方法,修改 tomcat 默认的 jdk到 1.7 : 1) 修改bin文件夹下面的catalina.bat文件,把如下内容rem ----- Execute The Requested Command

解决新建Support7Demos的sample时出现编译错误和运行报错出现的问题

右键New->Other->Android Sample Project->选择Android 4.4.2->选择Support7Demos ,finish. 会出现编译错误 解决如下: 1.把这三个文件导入到Eclipse里, 这三个是库文件,并且勾选COPY到工作空间里选项 如果没有这三个文件,就从这里下载 2.导入三个library工程后,mediarouter会无法编译,打开工程属性在anroid里将api-level改成17,添加依赖工程appcompat 3.就是将刚才

windows 2003 64位系统php运行报错:1%不是有效的win32应用程序解决办法

windows 2003 64位系统php运行报错:1%不是有效的win32应用程序 解决办法:运行-CMD cscript c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1