Multi-application start-up of Docker container

Source: Internet
Author: User
Tags ssh

In the ordinary Ubuntu system, only need to start the script to write in the/etc/rc.local, you can achieve power-on from boot. But in Docker, this is not the case at all, so how do you start multiple applications at boot? By default, Ubuntu in Docker will start/bin/bash.


After I set up the rc.local, the specific content is as follows, for everyone's reference:

/etc/rc.local

/etc/init.d/ssh start
/root/wsdc_project/auto_start.sh


# Set Java class path
export JAVA_HOME=/ROOT/WSDC _project/resources/jdk1.7.0
export Jre_home=${java_home}/jre
export classpath=.:${java_home}/lib:${jre_ Home}/lib
Export Path=${java_home}/bin:${path}

/bin/bash

exit 0

Note1: Since SSH does not start, I write the command in rc.local;

Note2: All the scripts I started to apply were placed in/root/wsdc_project_auto_start.sh.

Note3: If you go into the container by Docker, the/etc/profile will not be loaded automatically, so the Java environment I set up in it is not executed, so I wrote the statement in the export Java environment to/etc/rc.local.

Note4: It is important to note that the/bin/bash is placed at the end, because through the Docker container into the time, is to perform to/bin/bash, and then we can go in, after the/bin/bash statement only when we exit, will be executed to.

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.