Two ways to create a boot container for a docker mirror Difference introduction (summary article) _docker

Source: Internet
Author: User
Tags chmod docker run

Docker is based on the Linux kernel, in the current mainstream Linux system, have already native support Docker and the experience is also the best, of course, in the Windows platform and MacOS system also support Docker, You just need to use virtualization tools like Boot2docker to provide Linux support.

The following focuses on the two types of creating Docker mirror based on the start of the container differences, interested friends can follow the small set together to learn!

1. Any mirror generated by Docker commit can load a script that launches its own application, for example:

Docker run-d-P tomcat7.0b:jdk1.6/run.sh

The final/run.sh is to start the Tomcat application, which means that the Tomcat application is launched when the container is started. Otherwise it just starts the container and does not start its own application.

Run.sh contents are as follows:

#!/bin/bash
/usr/sbin/sshd-d &
exec ${catalina_home}/bin/catalina.sh Run

And note that the container is now instantiated based on docfile file-generated mirrors, and if you do, and then use Docker commit to generate a new mirror based on the container, then the container based on the new mirror will be loaded with a step to start your application.

2. When mirroring is generated with the Docfile file, it is not necessary to start the container without adding the script.

From Sshd3:ubuntu
maintainer waitfish from dockerpool.com (978145009@qq.com)
ENV debian_frontend noninteractive
RUN echo "Asia/shanghai" >/etc/timezone && dpkg-reconfigure-f noninteractive tzdata
RUN apt-get install-yq--no-install-recommends wget pwgen ca-certificates && apt-get clean && rm-rf /var/lib/apt/lists/*
env catalina_home/tomcat 
env java_home/jdk
ADD apache-tomcat-7.0.69/tomcat
Add jdk1.6.0_45/jdk
#ADD create_tomcat_admin_user.sh/create_tomcat_admin_user.sh
add run.sh/run.sh
Run chmod +x/*.sh
run chmod +x/tomcat/bin/*.sh expose 8080
CMD ["/run.sh"]

Because the last line of CMD is to represent the startup container, this script is invoked.

The above is a small set to introduce the two kinds of create Docker mirror the start of the container when the difference summary, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.