Making Docker Images

Source: Internet
Author: User
Tags docker run

1, make the Java running Environment image

My base image is based on the official CentOS 7.2 version of the website, no advance download is possible.

#docker Pull Docker.io/centos

[Email protected] ~]# mkdir-p/opt/dockerfile/jre1.7

[Email protected] ~]# cd/opt/dockerfile/jre1.7

[[email protected] jre1.7]# ls

Dockerfile server-jre-7u80-linux-x64.tar.gz


[email protected] jre1.7]# cat Dockerfile

From Centos:latest

maintainer yy env java_version  "7u80" env jdk_version  "1.7.0_80" RUN rpm  --rebuilddb     && yum --setopt=tsflags=nodocs -y  install     net-tools     && rm -rf / var/cache/yum/* && yum clean all#run rpm --import http:// Mirror.centos.org/centos/rpm-gpg-key-centos-7 #    && yum update  && yum install net-tools -y run mkdir -p /usr/lib/jvm  copy server-jre-${java_version}-linux-x64.tar.gz /usr/lib/jvm/server-jre-${java_version}- linux-x64.tar.gz run cd /usr/lib/jvm     && tar - Zxvf server-jre-${java_version}-linux-x64.tar.gz     && rm -rf  /usr/lib/jvm/server-jre-${java_verSion}-linux-x64.tar.gz     && ln -s /usr/lib/jvm/jdk${jdk_ Version}/bin/java /bin/     && cd /usr/lib/jvm/jdk${jdk_ version}     && find . -type f -name  ' *.html '  -delete     && find . -type f -name  ' COPYRIGHT '  -delete     && find . -type f -name   ' LICENSE '  -delete     && find . -type f - name  ' NOTICE '  -delete     && find . -type f  -name  ' 3RDPARTY '  -delete     && find . -type  f -name  ' *.txt '  -delete     && find . - type f -name  ' *.bat ' -delete      #jre包可以再做精简 




2. Making production environment Tomcat image

[Email protected] ~]# mkdir-p/OPT/DOCKERFILE/TOMCAT7

[Email protected] ~]# CD/OPT/DOCKERFILE/TOMCAT7

[[email protected] tomcat7]# ls

Apache-tomcat-7.0.70.tar.gz Dockerfile

[email protected] tomcat7]# cat Dockerfile

from java7:7u80maintainer yyenv tomcat_version 7.0.70env catalina_home / tomcatenv app_dir ${catalina_home}/webapps/run rpm --rebuilddb      && yum --setopt=tsflags=nodocs -y install     apr  tomcat-native     && rm -rf /var/cache/yum/* & & yum clean all#run wget -q https://archive.apache.org/dist/tomcat/tomcat-${ tomcat_major_version}/v${tomcat_minor_version}/bin/apache-tomcat-${tomcat_minor_version}.tar.gz#https:// archive.apache.org/dist/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gzcopy apache-tomcat-${ tomcat_version}.tar.gz apache-tomcat-{tomcat_version}.tar.gzrun tar zxf apache-tomcat-*. tar.gz &&     rm apache-tomcat-*.tar.gz &&      mv apache-tomcat* tomcat &&     rm -rf tomcat/webapps/* &&      sed -i  '/protocol= ' ajp\/1.3 '/d '  /tomcat/conf/server.xml     expose 8080 entrypoint ["/tomcat/bin/catalina.sh", "Run"]ONBUILD ADD  . ${app_dir}

Make image

[[email protected] tomcat7] #docker build-t tomcat7:7.0.70.


Launches a Tomcat container from the mirror, deploys the test program to/www/app1/webapps and accesses it from the browser

[email protected]]# Docker run-d-P 8002:8080--name mytomcat7-v/www/app1/webapps/:/tomcat/webapps tomcat7:7.0.70


3. Making Database mariadb image


Making Docker Images

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.