exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 158 discussion

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

A local Docker alpine image has been created with an image ID of a391665405fe and tagged as `latest`. Which command creates a running container based on the tagged image, with the container port 8080 bound to port 80 on the host?

  • A. docker build -p 8080:80 alpine:latest
  • B. docker exec -p 8080:80 alpine:latest
  • C. docker start -p 8080:80 alpine:latest
  • D. docker run -p 8080:80 alpine:latest
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
hackerman88
Highly Voted 3 years, 5 months ago
all answers are incorrect.. -p hostPort:containerPort so the correct command should be: docker run -p 80:8080 alpine:latest the host port and container port are all in the wrong order.
upvoted 43 times
mdawg
3 years, 3 months ago
You have the ports mixed up, the correct answer is D. From Cisco Networking Academy Lab - Build a Sample Web App in a Docker Container: "docker run -t -d -p 8080:8080 --name samplerunning sampleapp The docker run options indicate the following: o -t specifies that you want a terminal created for the container so the you can access it at the command line. o -d indicates that you want the container to run in the -p specifies that you want to publish the container’s internal port to the host. The first "8080" references the port for the app running in the docker container (our sampleapp). the second "8080" tells docker to use this port on the host. These values do not have to be the same. For example, an internal port 80 to external 800 (80:800)."
upvoted 4 times
sergeyn
3 years, 2 months ago
I would trust the vendor documentation, which is docker, instead of somebody's (even Cisco's) learning resources. So yes, all answers are incorrect (though for me 'container-ip:container-port:host-port' is more logical than 'container-ip:host-port:container-port' - all questions to the docker's creators). Overall, option D is the closest to correct one
upvoted 7 times
...
...
q82
3 years, 3 months ago
https://docs.docker.com/config/containers/container-networking/
upvoted 1 times
...
...
concepcionz
Most Recent 2 years ago
Woudnt be "docker run -p 80:8080 alpine:latest"?
upvoted 3 times
herrmann69
10 months ago
Yes, they mixed up the host and container ports.
upvoted 1 times
...
...
educan
2 years, 5 months ago
the question is not done well. Should be "with the Docker host port 8080 bound to port 80 on the Container..... The rule is this: docker -p 8080:80 Map TCP port 80 in the container to port 8080 on the Docker host.
upvoted 1 times
aplicacion101
2 years ago
All your should read very well the text into Docker. When I run a container put localhost:8080 for conect to the contanier which map with the port 80 executed for the app.
upvoted 2 times
...
...
designated
2 years, 9 months ago
Also, it is good to know: When working with containers, the key commands are as follows: - create: Create a container from an image. - start: Start an existing container. - run: Create a new container and start it. - ls: List running containers. - inspect: Get detailed information regarding the container. - logs: Print run logs from the container’s execution. - stop: Gracefully stop running the container. - kill: Stop the main process in the container abruptly. - rm: Delete a stopped container.
upvoted 2 times
...
designated
2 years, 9 months ago
Selected Answer: D
D is correct: Question keys: Docker alpine image has been created = the container is already built running container = run command must be used container port = 8080 host port = 80 image = alpine tag = latest D is correct being these key values from the question: docker run -p 8080:80 alpine:latest Note: -p is publishing the port
upvoted 1 times
...
DR_BDR
3 years, 6 months ago
"Now that we have an image, let’s run the application. To do so, we will use the docker run command" should be D https://docs.docker.com/get-started/02_our_app/
upvoted 1 times
...
Mellon
3 years, 6 months ago
start: Start an existing container. run: Create a new container and start it. Since the container has been created, it should be C.
upvoted 2 times
leranay
3 years, 6 months ago
The container has never been created in this context. The Docker image (built command) has been created. But the command "docker create" has not been executed. Therefore as @Deepzi states, it should be D not C.
upvoted 2 times
...
Deepzi
3 years, 6 months ago
the question says "Which command creates a running container...." Note the word "creates". Shouldnt it be run in that case?
upvoted 2 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 ...