exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 155 discussion

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

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
  • B. port 3000
  • C. any port between 3000 and 5000
  • D. port 5000
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
aplicacion101
Highly Voted 2 years, 8 months ago
Selected Answer: B
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
upvoted 11 times
...
anagy11
Highly Voted 3 years, 2 months ago
Selected Answer: D
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.
upvoted 7 times
[Removed]
3 years, 2 months ago
Agree.
upvoted 1 times
...
...
dexcript
Most Recent 10 months ago
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.
upvoted 1 times
...
herrmann69
1 year, 3 months ago
Selected Answer: B
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?
upvoted 1 times
...
working_on_hcip
1 year, 7 months ago
Selected Answer: B
local or external services will connect to port 3000 and then it will be redirected to port 5000 running inside docker container
upvoted 2 times
...
ripu106
1 year, 11 months ago
Answer should be -A (port 3000)
upvoted 1 times
...
m4xr1s
2 years, 2 months ago
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..
upvoted 3 times
...
chris_edwards
2 years, 4 months ago
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.
upvoted 1 times
...
mellohello
2 years, 4 months ago
Selected Answer: D
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.
upvoted 1 times
...
Angryeyebrows
2 years, 10 months ago
Selected Answer: B
" -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
upvoted 6 times
...
Toxkalcan
2 years, 11 months ago
Selected Answer: B
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
upvoted 4 times
...
ST551
3 years, 1 month ago
Selected Answer: D
D is correct
upvoted 2 times
aplicacion101
2 years, 7 months ago
Bad opcion
upvoted 1 times
...
...
ST551
3 years, 1 month ago
Selected Answer: B
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....
upvoted 2 times
...
ST551
3 years, 1 month ago
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....
upvoted 1 times
ST551
3 years, 1 month ago
Answer is D (port 5000) after reading the doc again... mod is there a way to update the content before it gets published?
upvoted 1 times
...
...
robcamac
3 years, 1 month ago
Definitely D ... command syntax is -p host_ip:host_port:container_port/protocol
upvoted 1 times
...
[Removed]
3 years, 2 months ago
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
upvoted 4 times
...
sds85
3 years, 2 months ago
Selected Answer: B
from documentation: -p 8080:80 Map TCP port 80 in the container to port 8080 on the Docker host.
upvoted 4 times
art_tv
2 years, 11 months ago
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.
upvoted 1 times
art_tv
2 years, 11 months ago
by other words, they don't ask here how to access docker container externally
upvoted 1 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 ...