启动docker run 报错:iptables No chain/target/match by that name

一、启动容器报错

[root@master69 ~]# docker run --name portainer-d -p 8000:8000 -p 9000:9000 -v  /var/run/docker.sock:/var/run/docker.sock portainer/portainer
docker: Error response from daemon: driver failed programming external connectivity on endpoint portainer-d (dc4dfc703d5334bf10389db5b609b156a335fe76bb7ebfe115141317eccb5c92):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 172.17.0.2:9000 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).
ERRO[0000] error waiting for container: context canceled 

二、原因

centos7默认防火墙为firewalld,而不是iptables,而docker使用iptables来做端口映射,所以一旦将firewalld关闭,则会报错

三、解决

安装iptables服务

[root@master69 ~]# yum install iptables -y

 

上一篇:iptables整理总结


下一篇:nginx 学习(一)