启动项目时报错: java.net.NoRouteToHostException: No route to host;该问题是因为我从一个容器访问另一个容器时被防火墙阻止,解决办法:
1.设置防火墙规则vi /etc/sysconfig/iptables
2.关闭防火墙;若直接关闭防火墙,启动容器时会报错:iptables:No chain/target/match by the name
解决办法:docker 服务启动的时候,docker服务会向iptables注册一个链,以便让docker服务管理的containner所暴露的端口之间进行通信
通过命令iptables -L可以查看iptables 链
在开发环境中,如果你删除了iptables中的docker链,或者iptables的规则被丢失了(例如重启firewalld),docker就会报iptables error例如:failed programming external connectivity … iptables: No chain/target/match by that name
要解决这个问题,只要重启docker服务,之后,正确的iptables规则就会被创建出来
1.设置防火墙规则vi /etc/sysconfig/iptables
2.关闭防火墙;若直接关闭防火墙,启动容器时会报错:iptables:No chain/target/match by the name
解决办法:docker 服务启动的时候,docker服务会向iptables注册一个链,以便让docker服务管理的containner所暴露的端口之间进行通信
通过命令iptables -L可以查看iptables 链
在开发环境中,如果你删除了iptables中的docker链,或者iptables的规则被丢失了(例如重启firewalld),docker就会报iptables error例如:failed programming external connectivity … iptables: No chain/target/match by that name
要解决这个问题,只要重启docker服务,之后,正确的iptables规则就会被创建出来