Refer to the exhibit. A process running on the host wants to access the service running inside this Docker container. Which port or ports are used to make a connection?
A.
only outbound connections between 3000 and 5000 are possible
https://docs.docker.com/desktop/networking/
Port Mapping
When you run a container with the -p argument, for example:
docker run -p 80:80 -d nginx
Docker Desktop makes whatever is running on port 80 in the container (in this case, nginx) available on port 80 of localhost.
In this example, the host and container ports are the same.
If, for example, you already have something running on port 80 of your host machine, you can connect the container to a
different port:
docker run -p 8000:80 -d nginx
Now, connections to localhost:8000 are sent to port 80 in the container.
The syntax for -p is HOST_PORT:CLIENT_PORT.
B is correct
It should be D as stated by sds85.
Documentation: https://docs.docker.com/config/containers/container-networking/#:~:text=Published%20ports&text=To%20make%20a%20port%20available,host%20to%20the%20outside%20world.
Based on this, -p 3000:5000 means mapping container port 5000 to host port 3000.
As the host want to access the container's service (which is published on port 5000), the host has to access container port 5000.
If the process were to be another container and it was deployed using the same docker virtual network, than yes the port would be 5000 , if the process was generic one would be 3000. I think is answer is B based on that.
A process running on the host wants to access the service running inside this Docker container. Which port or ports are used to make a connection?
https://docs.docker.com/network/
"-p 3000:5000" - Map port 3000 on the Docker host to TCP port 5000 in the container.
Another process can now reach the service running inside the container on:
- localhost:3000
or
- <IP address from the default docker network>:5000 ; port 5000 is not reachable via localhost
Since this question is from an associate exam, there is no need to overthink. I would choose answer B. This question is only checking if you know the syntax.
Using port 3000 on the host is easier and is how you would normally do it. Why would you map the host port from 3000 to 5000, if you are using it directly through the internal docker network ip adress with port 5000?
Both is possible.
It depends if you go for localhost and use the host port 3000 or with the container ip from the docker network and use port 5000
Only Cisco knows..
The Answer is D
To access a service running inside a Docker container from the host, you need to know the port number that the service is listening on inside the container, and you also need to know the port number that is exposed on the host. These two port numbers do not have to be the same.
For example, if a service inside the container is listening on port 8080, and you want to access it from the host, you can expose that port on the host by using the -p option when starting the container. For example:
docker run -p 8080:8080 mycontainer
This will expose port 8080 on the host, and any traffic sent to that port on the host will be forwarded to port 8080 inside the container.
In the docker run command, the -p flag is used to bind a host port to a container port. In this case, the command specifies that the host port 3000 should be bound to the container port 5000. This means that a process running on the host can access the service running inside the container by connecting to port 5000 on the host.
Outbound connections between ports 3000 and 5000 are not mentioned in the command, so they are not relevant to the question.
" -p 8080:80 would expose port 80 from inside the container to be accessible from the host's IP on port 8080 outside the container."
Therefore in this scenario it is 3000
it is asking which port is used by the process running on host. Host port is 3000 which is mapped to 5000 port on Docker . So answer is B , port 3000 on host
Answer is B (port 3000)... Go read the doc carefully whoever says D is the answer. It's not so difficult to understand the concept, just a simply mapping mechanism. '-p HOST_PORT:CONTAINER_PORT' i.e. -p 3000:12345 means in order to access docker from outside of host, you will use port 3000 on the host level, then it will connect into Docker service running inside of the host. Simply as that....
Answer is B (port 3000)... Go read the doc carefully whoever says D is the answer. It's not so difficult to understand the concept, just a simply mapping mechanism. '-p HOST_PORT:CONTAINER_PORT' i.e. -p 3000:12345 means in order to access docker from outside of host, you will use port 3000 on the host level, then it will connect into Docker service running inside of the host. Simply as that....
3000 would be internal container port
5000 would be external port that clients should access
It's a tricky question, but put your brain to function. Which port the external client should access? Port 5000
So the answer is D
yes, your statement above is right. However question says: "A process running on the host wants to access the service running inside this Docker container".
So for me key words here 'on the host' and 'inside container'. Meaning that port 80 (or port 5000) is also accessible for application running on this host.
If they ask about application outside who wants to use docker container service, then - yes, it has to be 8080 (or 3000).
To me it's tricky question.
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.
aplicacion101
Highly Voted 2 years, 8 months agoanagy11
Highly Voted 3 years, 2 months ago[Removed]
3 years, 2 months agodexcript
Most Recent 10 months agoherrmann69
1 year, 3 months agoworking_on_hcip
1 year, 7 months agoripu106
1 year, 11 months agom4xr1s
2 years, 2 months agochris_edwards
2 years, 4 months agomellohello
2 years, 4 months agoAngryeyebrows
2 years, 10 months agoToxkalcan
2 years, 11 months agoST551
3 years, 1 month agoaplicacion101
2 years, 7 months agoST551
3 years, 1 month agoST551
3 years, 1 month agoST551
3 years, 1 month agorobcamac
3 years, 1 month ago[Removed]
3 years, 2 months agosds85
3 years, 2 months agoart_tv
2 years, 11 months agoart_tv
2 years, 11 months ago