Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Cisco Certified DevNet Associate (DEVASC) · Cisco
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
When you run this command, Docker sets up a network rule that forwards traffic arriving at host_port on your machine to container_port inside the container. This allows you to access the application running inside the container from your host machine. For example, if you run the command docker run -p 8080:80 nginx, it will map port 8080 on your host machine to port 80 inside the container. This means that if the Nginx server inside the container is listening on port 80, you can access it by opening your web browser and going to http://localhost:8080 (or http://<your_host_ip>:8080 if you are accessing it from a different machine on the network)
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?