Docker and CI/CD · Junior · Question 9 of 75
Does EXPOSE 3000 in a Dockerfile make the port reachable from the host?
- ✓Correct answer: No, it only documents the port; publish it with
-p - 2Yes, but only when the container runs in detached mode
- 3Yes, it opens the port on every network interface of the host
Explanation
EXPOSE is metadata for people and tools. docker run -p 8080:3000 (or ports: in Compose) actually maps a host port to the container port.