如果我输入
正如错误提示所示,它找不到匹配规则。我应该如何输入以删除这行?
iptables -L
,输出中会有这样一行内容:Chain DOCKER (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:http-alt
我的容器是公开暴露的,我可以从任何地方请求一个虚拟的http服务器(已测试)。我尝试去除此规则,以便仅在我的服务器内部暴露80端口(localhost:80
)。我尝试了以下方法:
root@ns25252:~# iptables -D DOCKER --destination 172.17.0.2 -p tcp --dport 80 -j ACCEPT
iptables: Bad rule (does a matching rule exist in that chain?).
正如错误提示所示,它找不到匹配规则。我应该如何输入以删除这行?
sudo iptables -S | grep -i docker
,您会得到四个(新的/-N
)docker链。在删除规则之后,我们应该-N
→-F
吗? - Pablo Bianchi