Skip to content

Commit f4dc5b2

Browse files
committed
The current description of the EXPOSE command for Dockerfiles is a little bit misleading. It indicates that the EXPOSE command actually "opens" any ports for the outside world, which is not true. In this way, the description suggests that using the EXPOSE directive is absolutely necessary for doing a port mapping for the containerized flask app. This commit fixes that and replaces the existing description of the EXPOSE command, whilst also adding a hint for not mix up the meanings of "expose" and "publish".
1 parent 2ba7f3e commit f4dc5b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

beginner/chapters/webapps.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,11 @@ Here's a quick summary of the few basic commands we used in our Dockerfile.
459459
CMD ["/bin/bash", "echo", "Hello World"]
460460
```
461461

462-
* `EXPOSE` opens ports in your image to allow communication to the outside world when it runs in a container.
462+
* `EXPOSE` creates a hint for users of an image which ports provide services. It is included in the information which
463+
can be retrieved via `$ docker inspect <container-id>`.
464+
465+
>**Note:** The `EXPOSE` command does not actually make any ports accessible to the host! Instead, this requires
466+
publishing ports by means of the `-p` flag when using `$ docker run`.
463467

464468
* `PUSH` pushes your image to Docker Hub, or alternately to a [private registry](TODO: add URL)
465469

0 commit comments

Comments
 (0)