Docker
/Beginner
EXPOSE
Definition
An instruction that functions as a type of documentation, informing Docker that the container listens on specific network ports at runtime.
Explain Like I'm New
Putting a sign on the door that says 'I am a web server inside here, I will be listening on Port 80.' It doesn't actually open the door, it just tells humans and automated tools what to expect.
Real World Example
A Node.js backend runs on port 3000. You write `EXPOSE 3000` in the Dockerfile. When another developer looks at your file, they immediately know they need to map port 3000 when running it.
Common Use Cases
- •Documentation
- •Inter-container communication hints
Interview Questions
basic
- Does the `EXPOSE 80` command actually publish the port to the public internet so you can view it in your browser?