运行docker容器:iptables:没有链/目标/匹配的名称

我试图运行一个容器,但我得到以下问题:

Error response from daemon: Cannot start container b005715c40ea7d5821b15c44f5b7f902d4b39da7c83468f3e5d7c042e5fe3fbd: iptables failed: iptables --wait -t filter -A DOCKER ! -i docker0 -o docker0 -p tcp -d 172.17.0.43 --dport 80 -j ACCEPT: iptables: No chain/target/match by that name. (exit status 1) 

这里是我使用的命令:

 docker run -d -p 10080:80 -v /srv/http/website/data:/srv/http/www/data -v /srv/http/website/logs:/srv/http/www/logs myimage 

我的服务器上没有打开80端口吗? 有什么我错过了docker接口? 我用这样的脚本使用iptables:

 #!/bin/sh # reset : iptables -t filter -F iptables -t filter -X # Block all : iptables -t filter -P INPUT DROP iptables -t filter -P FORWARD DROP iptables -t filter -P OUTPUT DROP # Authorize already established connections : iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # Authorize backloop : iptables -t filter -A INPUT -i lo -j ACCEPT iptables -t filter -A OUTPUT -o lo -j ACCEPT # Authorize ssh : iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 22 -j ACCEPT # Authorize HTTP : iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT # Authorize HTTPS : iptables -t filter -A INPUT -p tcp --dport 443 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT # Authorize DNS : iptables -t filter -A INPUT -p tcp --dport 53 -j ACCEPT iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 53 -j ACCEPT # Ping : iptables -t filter -A INPUT -p icmp -j ACCEPT iptables -t filter -A OUTPUT -p icmp -j ACCEPT # Authorize FTP : iptables -t filter -A INPUT -p tcp --dport 20 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 20 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 21 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 21 -j ACCEPT # # Authorize NTP : # iptables -t filter -A INPUT -p udp --dport 123 -j ACCEPT # iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT # Authorize IRC : iptables -t filter -A INPUT -p tcp --dport 6667 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 6667 -j ACCEPT # Authorize port 10000 (for Node.JS server) : iptables -t filter -A INPUT -p tcp --dport 10000 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 10000 -j ACCEPT # Authorize port 631 (Cups server) : iptables -t filter -A INPUT -p tcp --dport 631 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 631 -j ACCEPT # Authorize port 9418 (git) : iptables -t filter -A INPUT -p tcp --dport 9418 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 9418 -j ACCEPT 

我怎么能解决这个问题?

我相信这个问题是在这个范围之内的:

iptables -t filter -F

iptables -t filter -X

这清楚地表明了所有的链条。 一个可能的解决scheme是在iptables安装脚本之后启动docker守护进程。 否则,您将需要明确删除您感兴趣的链。

在irc.freenode.net#docker中,你已经说过你在Raspberry Pi上使用Arch Linux ARM。

如果您没有将此脚本作为systemd服务的一部分运行,那么我强烈build议转而使用该脚本,或者使用现有的iptables服务,并在适当的时候使用它们的能力来保存/恢复表。 如果您select移动到您自己的服务,请确保该单元声明它已订购Before=docker.service