解决 Docker 启动时报错:iptables: No chain/target/match by the name

解决 Docker 启动时报错:iptables: No chain/target/match by the name

admin
2022-02-12 / 0 评论 / 1,956 阅读 / 正在检测是否收录...

问题背景

在服务器上修改了端口的相关配置,导致jenkins的容器启动失败,报如下错误:

Cannot start service jenkins: driver failed programming external connectivity on endpoint jenkins (289b01f799f57f40a1bca130235548bf664dcb7ca042ea74f6fa7fa578c5913c): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 50000 -j DNAT --to-destination 172.17.0.2:50000 ! -i docker0: iptables: No chain/target/match by that name.

解决方案
根据前半段的信息去 google 上查找问题,发现并没有相关的资料。看到里面有关键字iptables,觉得问题应该在这。直接搜索 iptables: No chain/target/match by that name 找到了答案。

  1. 清空所有的 iptables chains
sudo iptables -t filter -F
sudo iptables -t filter -X
  1. 重启 docker 服务即可
sudo systemctl restart docker
2

评论

博主关闭了所有页面的评论