Create a docker image, initialize the JDK8 with the Tomcat environment

Source: Internet
Author: User

First, create the Dockerfile file:

Create the Dockerfile file and download the JDK with Tomcat in the Dockerfile directory.

Dockerfile File Contents:

1From Ubuntu:14.102 Maintainer Linx3 4 #把java与tomcat添加到容器中5ADD jdk-8u31-linux-x64.Tar. gz/usr/local/6ADD apache-tomcat-8.0. -.Tar. gz/usr/local/7 8 #配置java与tomcat环境变量9ENV Java_home/usr/local/jdk1.8. 0_31TenENV CLASSPATH $JAVA _home/lib/dt.jar: $JAVA _home/lib/Tools.jar OneENV catalina_home/usr/local/apache-tomcat-8.0. - AENV catalina_base/usr/local/apache-tomcat-8.0. - -ENV PATH $PATH: $JAVA _home/bin: $CATALINA _home/lib: $CATALINA _home/bin -  the #容器运行时监听的端口 -EXPOSE8080

Second, create the image

1 perform  docker build–t linx/tomcat.  Command

Third, enter the container:

1 Execute   18080:8080 linx/2 start Tomcat   ./usr/local/apache-tomcat- 8.0. /bin/startup. SH

can be accessed via the host's 18080 port or via the container 8080 port after boot  

You can also start a shared host directory using-V: Docker run–i–t–p 18080:8080–v/usr/local/dockerdata:/usr/local/docker Linx/tomcat

Mount the host's/usr/local/dockerdata to the container/usr/local/docker directory for shared data

modifications to the container can be used to save the image for later use

1  Docker commit Containerid LINX/TOMCAT3

Save the container Containerid as an image

Save the container Containerid as an image

Article starting address: Solinx

http://www.solinx.co/archives/152

Create a docker image, initialize the JDK8 with the Tomcat environment

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.