nerdexam
Cisco

200-901 · Question #192

Refer to the exhibit. Which function does the EXPOSE line perform when building an image from this Dockerfile?

The correct answer is C. Local port 8080 is accessible from other containers running on the same docker host as the. The EXPOSE instruction informs Docker that the container listens on the specified network ports The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container…

Application Deployment and Security

Question

Refer to the exhibit. Which function does the EXPOSE line perform when building an image from this Dockerfile?

Exhibit

200-901 question #192 exhibit

Options

  • ALocal port 8080 of the container that launched with this docker image is accessible from co-
  • BLocal port 8080 is not reachable at all because no IP address is specified along with the EXPOSE
  • CLocal port 8080 is accessible from other containers running on the same docker host as the
  • DLocal port 8080 of the container that launched with this docker image is accessible to external

How the community answered

(23 responses)
  • B
    4% (1)
  • C
    91% (21)
  • D
    4% (1)

Explanation

The EXPOSE instruction informs Docker that the container listens on the specified network ports The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published. To actually publish the port when running the container, use the -p flag on docker run to publish and map one or more ports, or the -P flag to publish all exposed ports and map them to high-order ports. Regardless of the EXPOSE settings, you can override them at runtime by using the -p flag. https://docs.docker.com/engine/reference/builder/

Topics

#Dockerfile#Docker EXPOSE#Container Networking#Docker Image Building

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice