From 22fedb8914826b34328a33ecfe1ecc14f1e6cb84 Mon Sep 17 00:00:00 2001 From: Dean Chen <862469039@qq.com> Date: Sun, 16 Aug 2026 01:38:44 +0500 Subject: [PATCH] docs: say ARG/ENV names for Dockerfile substitution Hyphens are not part of the name, so $foo-bar is $foo plus -bar. RUN still lets the shell do whatever the OS accepts. Signed-off-by: Dean Chen <862469039@qq.com> --- .../docker-concepts/building-images/writing-a-dockerfile.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md b/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md index 0135769e7749..c13bbb16ae60 100644 --- a/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md +++ b/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md @@ -49,6 +49,7 @@ Some of the most common instructions in a `Dockerfile` include: - `COPY ` - this instruction tells the builder to copy files from the host and put them into the container image. - `RUN ` - this instruction tells the builder to run the specified command. - `ENV ` - this instruction sets an environment variable that a running container will use. +- `ARG [=]` - a build-time variable. Names the Dockerfile interpolates (`$NAME` / `${NAME}`) should be letters, digits, and `_`, and must not start with a digit. `ARG foo-bar` then `$foo-bar` is `$foo` plus the text `-bar`. `RUN` lets the shell expand whatever the image's OS accepts. - `EXPOSE ` - this instruction sets configuration on the image that indicates a port the image would like to expose. - `USER ` - this instruction sets the default user for all subsequent instructions. - `CMD ["", ""]` - this instruction sets the default command a container using this image will run.