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?
To create a running container based on a tagged Docker image with the container port 8080 bound to port 80 on the host, you use the docker run command with the -p flag.
A. docker build -p 8080:80 alpine
- Incorrect. docker build is used to build an image, not run a container. B. docker exec -p 8080:80 alpine
- Incorrect. docker exec is used to run a command in a running container. C. docker start -p 8080:80 alpine
- Incorrect. docker start starts a stopped container but does not create one. D. docker run -p 8080:80 alpine
- Correct. This command runs a new container from the image and maps the ports.
[:, Docker Run Command, ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit