这两天在新的服务器上使用docker,遇到了几个问题,做个记录,备忘。
- 关闭防火墙 docker无法启动
Error response from daemon: Cannot restart container c51ca8d4822c: driver failed programming external connectivity on endpoint collect (bf467ccf8745b05264cf008035a2f05fc5f9fd5763df61af219e254c8fa769d9): iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8081 -j DNAT --to-destination 172.17.0.3:8080 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)
- 启动防火墙后,docker中无法访问到宿主机局域网的FTP
java.net.NoRouteToHostException: No route to host
以上两个问题处理方式:
往/etc/sysconfig/docker中增加
other_args="--exec-driver=lxc --selinux-enabled"
关闭防火墙
重启docker systemctl restart docker
问题搞定