Docker Build Java+tomcat

Source: Internet
Author: User

1. Preparing packages for Java and Tomcat

Jdk-7u79-linux-x64.tar.gz

Apache-tomcat-7.0.57.tar.gz

2. Edit the Dockerfile file

Vim Dockerfile

1 from CentOS #基本镜像
2 ADD./jdk-7u79-linux-x64.tar.gz/root #将jdk拷贝到镜像的/root
3 ADD./apache-tomcat-7.0.57.tar.gz/root #将tomcat拷贝到镜像的/root
4 ENV java_home/root/jdk1.7.0_79 #设置java的环境变量
5 ENV PATH $JAVA _home/bin: $PATH #
6 RUN chmod +x/root/apache-tomcat-7.0.57/bin/*.sh #为tomcat下的启动脚本添加运行权限
7 entrypoint/root/apache-tomcat-7.0.57/bin/startup.sh && tail-f/root/apache-tomcat-7.0.57/logs/ Catalina.out

3. Docker images view the generated image

4. Docker run-d-P 8090:8080 2e6b111736df #运行镜像

5. Docker PS #查看运行的镜像

6. Visit http://host:8090

Docker Build Java+tomcat

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.