QuestionQ220

Application Deployment and Security

Refer to the exhibit.

Question Image

What function does the EXPOSE line perform when an image is built from this Dockerfile?

  • A Local port 8080 of the container that launched with this docker image is accessible from co-hosted containers and external clients.
  • B Local port 8080 is not reachable at all because no IP address is specified along with the EXPOSE command of the Dockerfile.
  • C Local port 8080 is accessible from other containers running on the same docker host as the container that launched with this docker image.
  • D Local port 8080 of the container that launched with this docker image is accessible to external clients.
Explanation

EXPOSE 8080 declares TCP port 8080 as a port on which the container is expected to listen. It does not publish the port to the host or make it externally reachable; host-to-container access requires runtime port publishing, such as -p. Containers that can communicate over the Docker network can use the container port directly.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!