Learn reserved word instruction under Dockerfile

  • FROM
    base image, a little java, inheritance, indicates that the current new image which is based on the mirror

  • MAINTAINER
    mirror maintainer name and email address

  • RUN
    need additional commands to execute when constructing a container, such as with the command yum install

  • EXPOSE
    designated port is currently exposed outside of the container

  • WORKDIR
    specify the working directory, can be understood as the container generates a default would do the operation in which the file path

  • ENV
    set environment variables, environment variables defined in the subsequent command, you can use this environment variable, if there are a lot of instruction should be used as a parameter, then use this to better safeguard

  • ARG
    build parameters, with the same effect ENV. But the difference in the build environment variable is not defined in the presence of a good image, and this point and ENV.

  • COPY
    copy instruction, copy the file from the context directory or directories specified in the path to the container

  • ADD
    in COPY basis, but also to achieve automatic processing URL and extract the tar archive, depending on whether you want to automatically decompress choose to use two kinds of commands COPY and ADD

  • CMD
    specified command a container when you start to run, but if Dockerfile If there is more than CMD command, only the last one will work, while CMD parameter will be replaced after the docker run

  • ENTRYPOINT
    specified command a container when you start to run, ENTRYPOINT parameters are not replaced after docker run, but will do additional command

  • VOLUME
    define a container volume data, and used for persistent data storage work

  • ONBUILD
    when constructing the sub-mirror, the mirror will trigger ONBUILD parent instruction execution

  • USER
    used to specify the subsequent commands users and user groups

  • HEALTHCHECK
    used to specify a program or command to monitor the docker container services operating state

to sum up

Dockerfile can imagine docker image description file, docker image is created out according to this description file can be likened to the java class files, documentation on the shining instructions, read the obstacles will be much smaller, although it may still not understand, but at least not be afraid.

Published 289 original articles · won praise 302 · views 50000 +

Guess you like

Origin blog.csdn.net/weixin_38106322/article/details/105065454