exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 159 discussion

Actual exam question from Cisco's 200-901
Question #: 159
Topic #: 1
[All 200-901 Questions]

Refer to the exhibit.

Which function does the EXPOSE line perform when building an image 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.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Daeh
Highly Voted 3 years, 4 months ago
Wrong. This is only true if the port was "published". If the port was only exposed, then the service in the container is not accessible from outside Docker, but from inside other Docker containers. C is correct.
upvoted 12 times
herrmann69
9 months, 1 week ago
If it's only exposed, then the service is accessible from inside other Docker containers, but also from the host via the internal docker IP address. You can try it for yourself: # create an nginx container without any published ports sudo docker run nginx # show the default docker network information sudo docker inspect bridge # should show a container with the ipv4 address 172.17.0.2 or something similar # from the host, reach the exposed, but not published service curl 172.17.0.2:80 # <nginx reply>
upvoted 1 times
...
lincharl
3 years, 3 months ago
By default, the EXPOSE instruction does not expose the container’s ports to be accessible from the host. In other words, it only makes the stated ports available for inter-container interaction.
upvoted 4 times
...
...
daniii89
Most Recent 3 months, 1 week ago
Selected Answer: C
I think C. The EXPOSE command makes the port available to other containers running on the same host (via Docker’s internal networking). This means that services running inside other containers on the same Docker network can communicate with this container on port 8080.
upvoted 1 times
...
anagy11
2 years, 7 months ago
Selected Answer: C
C is correct According to vendor documentation: "The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. 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/
upvoted 2 times
[Removed]
2 years, 7 months ago
You are correct. The EXPOSE means only internal not external clients.
upvoted 1 times
...
...
sds85
2 years, 8 months ago
Selected Answer: C
https://stackoverflow.com/questions/22111060/what-is-the-difference-between-expose-and-publish-in-docker
upvoted 1 times
...
NullNull88
3 years ago
At this point I don't believe any of you. Just don't comment unless you are reasonably certain. Hold your ego it is ok we don't know each other. There's no pride among strangers,.... Let's help others, but if we can't let's at least not hurt them with wrong horribly wrong answers
upvoted 2 times
...
richard2865
3 years ago
C By default, the EXPOSE instruction does not expose the container’s ports to be accessible from the host. In other words, it only makes the stated ports available for inter-container interaction. Whereas publishing a port using either -P or -p exposes it, exposing a port using EXPOSE or –expose does not publish it. So, while exposed ports can only be accessed internally, published ports can be accessible by external containers and services. https://www.whitesourcesoftware.com/free-developer-tools/blog/docker-expose-port/
upvoted 3 times
...
zefryx
3 years, 3 months ago
C - The EXPOSE instruction exposes the specified port and makes it available only for inter-container communication.
upvoted 1 times
...
ionycash
3 years, 4 months ago
Must be D The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. You can specify whether the port listens on TCP or UDP, and the default is TCP if the protocol is not specified. https://docs.docker.com/engine/reference/builder/
upvoted 2 times
...
Deepzi
3 years, 5 months ago
Wouldnt the answer be A ? both co-hosted and external ?
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago