官术网_书友最值得收藏!

Dockerfile commands

The following list is a similar one, but this time, we are covering the commands you can use in a Dockerfile, and we've arranged it in an order similar to the one you would use when working within the Dockerfile:

FROM <image_name>[:<tag>]: Base the current image on <image_name>
LABEL <key>=<value> [<key>=value>...]: Add metadata to the image
EXPOSE <port>: Indicate which port should be mapped into the container
WORKDIR <path>: Set the current directory for the following commands
RUN <command> [ && <command>... ]: Execute one or more shell commands
ENV <name>=<value>: Set an environment variable to a specific value
VOLUME <path>: Indicates that the <path> should be externally mounted volume
COPY <src> <dest>: Copy a local file, a group of files, or a folder into the container
ADD <src> <dest>: The same as COPY but can handle URIs and local archives
USER <user | uid>: Set the runtime context to <user> or <uid> for commands after this one
CMD ["<path>", "<arg1>", ...]: Define the command to run when the container is started

Since almost all containers you would want to build can be constructed with this set, this list is not the whole superset of Docker commands, and a few of them have been intentionally left out. If you get curious about things such as ENTRYPOINT, ARG, HEALTHCHECK, or others, you can check out the complete documentation at https://docs.docker.com/engine/reference/builder/.

主站蜘蛛池模板: 慈利县| 博爱县| 正镶白旗| 顺昌县| 宣武区| 邳州市| 长治市| 铁岭县| 湄潭县| 汉川市| 临朐县| 睢宁县| 突泉县| 香港| 万安县| 新营市| 丰顺县| 安吉县| 隆林| 铁岭县| 井冈山市| 兴山县| 溆浦县| 梅州市| 太白县| 四子王旗| 金堂县| 保山市| 潮安县| 五河县| 东丽区| 蒲城县| 寿光市| 密山市| 吉木萨尔县| 积石山| 巩义市| 灵寿县| 高安市| 安阳市| 宁远县|