1, first download Tomcat image
docker pull tomcat
2, Maven packaging commands
mvn clean install
3, Tomcat default port
8080
4, start Tomcat see if you can successfully start (basic command parameters, self Baidu bar)
docker run --name tomcat -d -p 8088:8080 tomcat
5, to see if the tour is successful start Tomcat
http://localhost:8088
6, Docker commonly used commands
// Check container Docker running
docker ps
// View all Docker containers
docker ps -a
// Check all mirrors Docker
docker images
// stop Docker container
docker stop container id
// delete Docker container
docker rm container id
// delete Docker image
docker rmi image id
7, the Copy War files to the internal Docker container (this step can be placed later execution)
docker cp source file path containers id: / usr / local / tomcat / webapps (path within the container)
8, stop Docker containers (see above command)
9, restart Docker mirror (Tomcat)
(
1, -v Docker mount directory command, details of Baidu.
2, the application.yml, and mounted to the Tomcat webapps directory host
)
docker run --name tomcat -d -p 8088:8080 \
-v /root/rc/rc-alarm-engine/application.yml:/application.yml \
-v /root/rc/increment/rc-alarm-engine:/usr/local/tomcat/webapps \
tomcat
10, Jenkins can also use the automated build, build the project automatically get the latest War files, and automatically generate a mirrored boot mount directory using the Dockerfile on it
FROM tomcat
MAINTAINER author information
RUN echo "Asia/Shanghai" > /etc/timezone
ADD rc-ae-server/target/*.war /usr/local/tomcat/webapps
11, Tomcat will automatically parse War package, and produce the same name directory under the same directory, run .Class file contains, by replacing .Class file, and restart the docker container to achieve incremental upgrade services,
// Docker containers restart
docker restart container id