1. Java Dockerfile
Create the project directory Java, upload the required Java version of the compressed package in the directory, and create the Dockerfile file, the project structure is as follows:
Java
-dockerfile
-jdk-8u111-linux-x64.gz
Dockerfile content:
# java# Version 1.8.0_111# source_imagefrom centos# maintainer_infomaintainer bluemooder [email protected]add jdk-8u111-linux-x64.gz/usr/local/# envenv java_home/usr/local/jdk1.8.0_111env PATH $JAVA _home/bin: $PATH
Create a Java image based on dockerfile content
Docker build-t zx/java:v1.8.0_111.
2. Tomcat Dockerfile
Based on the Java image generated above, customize the desired tomcat environment and create the Tomcat project directory with the following directory structure
Tomcat
-dockerfile
-APACHE-TOMCAT-8.0.46.TAR.GZ//Required Tomcat version
-logs//tomcat Container is running, specify the host hosts to hold the log folder
-webapps//tomcat Container Runtime, the war program is placed in the directory
Dockerfile content:
# source_imagefrom zx/java:v1.8.0_111# maintainer_infomaintainer bluemooder [email protected]env TOMCAT_VERSION 8.0.46ADD apache-tomcat-$TOMCAT _version.tar.gz/usr/local/run mv/usr/local/apache-tomcat-$TOMCAT _version/usr/ Local/tomcatworkdir/usr/local/tomcatexpose 8080CMD ["bin/catalina.sh", "Run"]
Create a Tomcat image based on dockerfile content
Docker build-t zx/tomcat:v8.0.46.
Running the Tomcat container
Docker run-d--name tomcat-zxapi-p 8080:8080-v ' pwd '/logs:/usr/local/tomcat/logs-v ' pwd '/webapps:/usr/local/tomcat/ WebApps zx/tomcat:v8.0.46
know-how Office, professional mobile office platform
"Director" 12 Spring and Autumn,[email protected];
"Master" Zelo,[email protected];
"Operations" Ops boatman ,[email protected];
"Product design" stray cats,[email protected];
"Experience Design",[email protected];
"IOS" Amoy code handyman,[email protected]; imcg33k,[email protected];
"Android", the Ape-Lay,[email protected]; an epiphany of thought,[email protected];
"Java" chief engineer Mr_w,[email protected];
"Test" the Earth Mirror asked,[email protected];
"Data" is much more joyful,[email protected];
"Security" is confidential, you know.
This article is from the "Ops boatman" blog, please make sure to keep this source http://bluemooder.blog.51cto.com/12822812/1967671
Docker Learning notes--java and Tomcat Dockerfile