Docker install tomcat
Search tomcat Mirror
docker search tomcat
It tomcat pulls the latest official image
docker pull tomcat
Create a container tomcat-test, the host of the 8080 port mapping to tomcat 8080 port
docker run --name tomcat-test -d -p 8080:8080 tomcat
Browser to open the input ip + 8080
Host directory to mount the container
- tomcat webapps container path: / usr / local / tomcat / webapps
- In the home directory new directory / home / ubuntu / tomcat / webapps
- Stop tomcat container and remove the container
Find a container CONTAINER ID
docker ps -a
Stop the container
docker stop CONTAINER_ID
Delete container
docker rm CONTAINER_ID
Re-run a tomcat container home directory and mount
docker run --name tomcat-service -d -p 8080:8080 -v /home/ubuntu/tomcat/webapps:/usr/local/tomcat/webapps tomcat