Docker Learning notes--java and Tomcat Dockerfile

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.