DCA · Question #115
DCA Question #115: Real Exam Question with Answer & Explanation
The correct answer is A: Yes. Using --publish (or -p) explicitly maps container ports to host ports, making the container reachable from the host's network, while EXPOSE merely documents the ports.
Question
You want to create a container that is reachable from its host's network. Does this action accomplish this? Solution: Use either EXPOSE or --publish to access the containers on the bridge network
Options
- AYes
- BNo
Explanation
Using --publish (or -p) explicitly maps container ports to host ports, making the container reachable from the host's network, while EXPOSE merely documents the ports.
Common mistakes.
- B. The
--publishoption specifically enables host-to-container port mapping, making the container accessible from the host network.
Concept tested. Docker container port publishing
Reference. https://docs.docker.com/engine/reference/run/#publish-or-expose-port-s
Topics
Community Discussion
No community discussion yet for this question.