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.