What command is used to create a new Docker container?

Prepare for the Docker Foundations Test. Review essential Docker concepts with multiple choice questions, each with hints and explanations. Ace your exam!

The command used to create a new Docker container is "docker run." This command not only creates the container but also starts it immediately. When you execute "docker run," it takes an image as an argument and creates a new container from that image, effectively combining the actions of both creating and starting a container into a single command.

Using "docker run" is very common in workflows, as it simplifies the process of instantiating containers from images. Additionally, this command allows you to specify various options and configurations for the new container, including environment variables, port mappings, and volume mounts at the time of creation.

In contrast, the command "docker create" only creates a new container without starting it, while "docker start" is used to start an existing stopped container. The command "docker build" is primarily used to build a Docker image from a Dockerfile and does not pertain directly to container creation.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy