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

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

问题背景

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

1
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
1
2
sudo iptables -t filter -F
sudo iptables -t filter -X
  1. 重启 docker 服务即可
1
sudo systemctl restart docker

转载需要保留原始链接,未经明确许可,禁止商业使用。CC BY-NC-SA 4.0

最后更新于 2023/12/05 21:48 CST
comments powered by Disqus
本博客已稳定运行
发表了77篇文章 · 总计103.35k字