FROM: Specifies the base image, you must first command
MAINTAINER: maintainer information
RUN: command to execute when building mirror
ADD: adding local files to the container, tar will automatically unzip the file type (compression network resources are not unpacked), you can access network resources, similar to wget
COPY: functions like ADD, but is not automatically unzip the file, can not access network resources
CMD: After building container calls, which is invoked only when the container starts.
ENTRYPOINT: Configuration container, make it executable oriented. CMD can save with the "application", use only parameters.
LABEL: for adding metadata mirror
ENV: setting environment variables
EXPOSE: Specifies the port to interact with the outside world
WORKDIR: working directory, similar to the cd command
Dockerfile
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
mc_start.sh
#! / bin / bash # chkconfig: 2345 10 90 # the Description: mc_start .... # start the server echo " service starts in ... " sed -i ' S / false / to true / G ' ./ eula.txt the Java -Xms120m -jar -Xmx160m / Home / Docker / minecraft_server. 1.10 . 2 .jar nogui echo " service started successfully ... "