Dockerfile instruction Introduction

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.
InstructionsFunction
FROMThe current image is based on which mirror image, the first instruction must be from
MAINTAINERMirror maintenanceer’s name and mailbox address
RUNDirectives that need to be run when building a mirror
EXPOSEThe port number of the current container exposed to the outside
WORKDIRSpecify the working directory of the terminal login default after creating a container
ENVUsed to set environment variables in the process of building mirror
ADDCopy the files in the host directory into the mirror, and the ADD command will automatically process URL to reconcile the tAR package
COPYSimilar 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
VOLUMEcontainer data volume, for data preservation and persistent work
CMDSpecify 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.
ENTRYPOINTSpecify the command to run when a container is started, specify the container startup program and its parameters
ARGConstructing 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.