Problems in using docker to deploy tomcat7 in centos7 system

Problem description, docker installs tomcat:
sudo docker pull tomcat:7.0

The installation is successful, but when starting tomcat:
sudo docker run -p 80:8080 tomcat:7.0
error: =============================== ===========
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)).

Solution:
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


Reference: https://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7

Then:
sudo iptables -t filter -N DOCKER


Then restart docker, this is important:
sudo systemctl restart docker.service


Also this docker startup stuck at:
INFO: Deploying web application directory /usr/local/tomcat/webapps/examples Waiting
a long time to continue


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326444761&siteId=291194637