From 4aa2b17afa4ff8d62aba0a2c91726faec7106ad0 Mon Sep 17 00:00:00 2001 From: Dean Chen <862469039@qq.com> Date: Sat, 15 Aug 2026 19:39:07 +0500 Subject: [PATCH] docs: mention EXPOSE can take a port range The reference syntax already allows it; the getting-started and best-practices pages only showed a single port. Signed-off-by: Dean Chen <862469039@qq.com> --- .../docker-concepts/building-images/writing-a-dockerfile.md | 2 +- content/manuals/build/building/best-practices.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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..d9905961cb00 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,7 +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. -- `EXPOSE ` - this instruction sets configuration on the image that indicates a port the image would like to expose. +- `EXPOSE ` - this instruction sets configuration on the image that indicates a port the image would like to expose. You can also give a range, for example `EXPOSE 3000-3005`. - `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. diff --git a/content/manuals/build/building/best-practices.md b/content/manuals/build/building/best-practices.md index f9485bb7f337..ac2d9e6c6561 100644 --- a/content/manuals/build/building/best-practices.md +++ b/content/manuals/build/building/best-practices.md @@ -526,7 +526,7 @@ The `EXPOSE` instruction indicates the ports on which a container listens for connections. Consequently, you should use the common, traditional port for your application. For example, an image containing the Apache web server would use `EXPOSE 80`, while an image containing MongoDB would use `EXPOSE 27017` and -so on. +so on. A range is valid too (`EXPOSE 3000-3005`). For external access, your users can execute `docker run` with a flag indicating how to map the specified port to the port of their choice.