温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
  • 首页 > 
  • 教程 > 
  • 开发技术 > 
  • 启动docker容器时报错iptables: No chain/target/match by that name怎么解决

启动docker容器时报错iptables: No chain/target/match by that name怎么解决

发布时间:2021-08-17 22:29:11 来源:亿速云 阅读:451 作者:chen 栏目:开发技术

这篇文章主要介绍“启动docker容器时报错iptables: No chain/target/match by that name怎么解决”,在日常操作中,相信很多人在启动docker容器时报错iptables: No chain/target/match by that name怎么解决问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”启动docker容器时报错iptables: No chain/target/match by that name怎么解决”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

具体报错:
[root @centos72 ~]# docker run -itd -v /data/drug_app_logs:/root/drug/logs —storage-opt size=30G -p 5001:22 -p 8989:8080 drug_app:latest /usr/sbin/sshd -D
b95132b92ec379e458d2e968eb78e642d57ed9bb895052f38992d839f35704e6
docker: Error response from daemon: driver failed programming external connectivity on endpoint adoring_lamport (ea38c59bb95348ac62a87bb4e0a41436ed64d67784312b020a21c4bc273fd859):  (iptables failed: iptables —wait -t nat -A DOCKER -p tcp -d 0/0 —dport 8989 -j DNAT —to-destination 172.17.0.2:8080 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).

通过网上查找:
因为在进行原地址到目标地址转换的时候没有在docker主机的iptables规则中找到nat表规则,只有filter表规则。
在filter表上面增加nat表配置规则信息,需要说明的是docker容器的网段是172.17.0.0/16,另外需要注意filter表中也要有docker链的相关配置。

然后想起刚刚把防火墙关了,造成了docker chain的变动,因此报错。

解决方法:
 systemctl restart docker

到此,关于“启动docker容器时报错iptables: No chain/target/match by that name怎么解决”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI