Docker - DockerFile Architecture (Detailed instructions reserved word)

DockerFile architecture

Here Insert Picture Description

  • FROM
    Base image, a new image is based on the current mirror

  • MAINTAINER
    Mirror defenders name and e-mail address

  • RUN
    Command need to run container building

  • EXPOSE
    External current container port exposed

  • WORKDIR
    After you create a designated container terminal logged in the default working directory, a foothold

  • ENV
    Used to set the environment variable to build the mirror process
    example: ENV MY_PATH / usr / mytest
    environment variables may be used in any subsequent RUN command, just as in the previous command prefix as the environmental variable;
    may be other instructions in use these environmental variables, such as: WORKDIR $ mY_PATH

  • ADD
    The host file in the directory image and copied into the ADD command processing URL and automatically extract the tar archive

  • COPY
    Similarly ADD, copy files and directories to the mirror.
    Building context from the directory <source path> file / directory to <destination path> in the new position of the mirror layer

    • COPY src dest
    • COPY [“src”, “dest”]
  • VOLUME
    Data volume container, for persistent data storage and work

  • CMD
    Command a vessel designated to run at startup.
    Here Insert Picture Description
    In DockerFIle can have multiple CMD command, but only the last one will work, CMD parameter will be replaced after the docker run.

  • ENTRYPOINT
    Specifies the command to start a container to run, ENTRYPOINT purpose and CMD, are used to specify the container and start the program parameters. (Will not be replaced, added)

  • ONBUILD
    Run command when building an inherited DockerFile, the father of the mirror after mirror quilt inherit, the parent is mirrored onbuild departure.
    Here Insert Picture Description

Published 589 original articles · won praise 1816 · Views 220,000 +

Guess you like

Origin blog.csdn.net/cold___play/article/details/103977689