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

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

admin
3年前发布 /正在检测是否收录...
温馨提示:
本文最后更新于2022年10月25日,已超过851天没有更新,若内容或图片失效,请留言反馈。

问题背景

在服务器上修改了端口的相关配置,导致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
  2. 重启 docker 服务即可

    sudo systemctl restart docker
© 版权声明
THE END
喜欢就支持一下吧
点赞 2 分享 收藏
评论
所有页面的评论已关闭