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.
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>
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.
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.
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/
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
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/
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/
Wouldnt the answer be A ? both co-hosted and external ?
upvoted 3 times
...
This section is not available anymore. Please use the main Exam Page.200-901 Exam Questions
Log in to ExamTopics
Sign in:
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.
Daeh
Highly Voted 3Â years, 4Â months agoherrmann69
9Â months, 1Â week agolincharl
3Â years, 3Â months agodaniii89
Most Recent 3Â months, 1Â week agoanagy11
2Â years, 7Â months ago[Removed]
2Â years, 7Â months agosds85
2Â years, 8Â months agoNullNull88
3Â years agorichard2865
3Â years agozefryx
3Â years, 3Â months agoionycash
3Â years, 4Â months agoDeepzi
3Â years, 5Â months ago