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?
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.
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)."
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
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.
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.
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.
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
"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/
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.
the question says "Which command creates a running container...." Note the word "creates". Shouldnt it be run in that case?
upvoted 2 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.
hackerman88
Highly Voted 3 years, 5 months agomdawg
3 years, 3 months agosergeyn
3 years, 2 months agoq82
3 years, 3 months agoconcepcionz
Most Recent 2 years agoherrmann69
10 months agoeducan
2 years, 5 months agoaplicacion101
2 years agodesignated
2 years, 9 months agodesignated
2 years, 9 months agoDR_BDR
3 years, 6 months agoMellon
3 years, 6 months agoleranay
3 years, 6 months agoDeepzi
3 years, 6 months ago