DELAPARRA
Index
Color
NL
Category: Docker

EXPOSE

Explained by Updated

What is EXPOSE?

EXPOSE: Documents which port the container listens on. It is metadata only — it does not actually publish the port. EXPOSE in a Dockerfile documents which port the application inside the container listens on, such as EXPOSE 8080. It does not open or publish anything. It is a note for people and tools. Someone reading the Dockerfile knows where the app listens, and docker run -P uses it to publish all exposed ports on random host ports.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about EXPOSE

What should you keep in mind with EXPOSE?

To make the port reachable from your computer, you still need -p 8080:8080 with docker run, or a ports entry in Compose. In Kubernetes, the container port and a Service do that job. Keep EXPOSE accurate anyway. It is the quickest way for the next developer to see which port the application expects, without digging through configuration files.

What does an example of EXPOSE look like?

EXPOSE 8080

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with E

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.