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

  • Deployment with Docker
  • Srdjan Grubor
  • 223字
  • 2021-07-02 23:22:15

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/.

主站蜘蛛池模板: 德江县| 赞皇县| 尉犁县| 呼伦贝尔市| 厦门市| 肇州县| 深圳市| 定日县| 新闻| 济南市| 措美县| 涞源县| 定南县| 连平县| 彩票| 大城县| 永修县| 兰坪| 磐安县| 黔南| 吴堡县| 新巴尔虎左旗| 蓝田县| 商洛市| 南充市| 屯昌县| 金阳县| 龙门县| 汝阳县| 香河县| 汝城县| 虹口区| 郧西县| 三门县| 剑川县| 兴山县| 石屏县| 通化市| 锦屏县| 北安市| 仪陇县|