service mc_start.sh does not support chkconfig

When building docker mirror, the mirror when writing Dockerfile build, configure custom startup script error, service mc_start.sh does not support chkconfig

Add the following two to #! After / bin / bash.

# chkconfig: 2345 10 90 
# description: myservice ....

Note: chkconfig command corresponding directory is the /etc/init.d folder needs to be copied to the startup script from the file directory. The following document is attached a Dockerfile

Where 2345 is the default start level, level 0-6 a total of seven levels.

  Level 0 means: that shutdown   

  Level 1 represents: single-user mode   

  Level 2 represents: Multiuser no network connection from the command line   

  Level 3 means: a multi-user network connection command line   

  Level 4, said: unavailable   

  Level 5 represents: multi-user mode with GUI   

  Level 6 says: Restart

10 is a boot priority, priority 90 is stopped, the priority range is 0-100, the larger the number, the lower the priority.

Dockerfile file

Image #base 
the FROM CentOS 
# MAINTAINER 
MAINTAINER [email protected] 
#run execute the following command 
RUN mkdir / Home / Docker 
# equivalent of cd 
WORKDIR / Home / Docker 

#add files in the current directory, copy past will automatically extract 
ADD minecraft_server. 1.10 . 2 .jar / Home / Docker 
the ADD mc_start. SH   / Home / Docker 
#run following command 
# installed JDK 
the RUN yum -Y the install Java- 1.8 . 0 - OpenJDK 
the RUN Java -Xms120m -Xmx160m -jar / Home / Docker / minecraft_server.1.10.2.jar nogui
RUN sed -i 's/eula = false/eula = true/g' ./eula.txt
RUN chmod 777 /home/docker/mc_start.sh\
    && cp -rf /home/docker/mc_start.sh /etc/profile.d\
    && cp -rf /home/docker/mc_start.sh /etc/init.d\
WORKDIR /etc/profile.d
RUN chkconfig --add /etc/profile.d/mc_start.sh\
    &&chkconfig /etc/profile.d/mc_start.sh on
#EXPOSE port mapping 
EXPOSE 25565

 

Guess you like

Origin www.cnblogs.com/lidedong/p/11420037.html