dockerfile instruction introduction
Dockerfile is a text file used to build a mirror image. The text content contains the instructions and descriptions required to build a mirror image.
Instructions | Function |
---|---|
FROM | The current image is based on which mirror image, the first instruction must be from |
MAINTAINER | Mirror maintenanceer’s name and mailbox address |
RUN | Directives that need to be run when building a mirror |
EXPOSE | The port number of the current container exposed to the outside |
WORKDIR | Specify the working directory of the terminal login default after creating a container |
ENV | Used to set environment variables in the process of building mirror |
ADD | Copy the files in the host directory into the mirror, and the ADD command will automatically process URL to reconcile the tAR package |
COPY | Similar functions to ADD, copy files and directory to mirrors, will be copied from the file/directory in the context directory to the position in the new layer of mirror |
VOLUME | container data volume, for data preservation and persistent work |
CMD | Specify the command to run when a container is started. There can be multiple CMD instructions in Dockerfile, but only the last one will take effect. |
ENTRYPOINT | Specify the command to run when a container is started, specify the container startup program and its parameters |
ARG | Constructing parameters is consistent with ENV, but the role is different. The environment variables set by ARG are only effective in Dockerfile, that is, it is effective in the process of only Docker Build. There is no such environment variable in the constructive mirror. |