sudo docker pull tomcat:7.0
安装成功,但是启动tomcat时:
sudo docker run -p 80:8080 tomcat:7.0
报错:========================================
docker: Error response from daemon: driver failed programming external connectivity on endpoint modest_austin (41031e4ae090c54a550be9ac7e7fc7b42612fa4a5482950ae46aa0570ecec567): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 80 -j DNAT --to-destination 172.17.0.3:8080 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).
解决办法:
systemctl stop firewalld systemctl mask firewalld
Then, install the iptables-services package:
yum install iptables-services
Enable the service at boot-time:
systemctl enable iptables
Managing the service
systemctl [stop|start|restart] iptables
Saving your firewall rules can be done as follows:
service iptables save or /usr/libexec/iptables/iptables.init save
参考:https://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7
然后:
sudo iptables -t filter -N DOCKER
然后重启docker,这点儿很重要:
sudo systemctl restart docker.service
另外这个docker启动卡在:
INFO: Deploying web application directory /usr/local/tomcat/webapps/examples
等很长时间才能继续