Which command is used to stop a running Docker container?

Prepare for the Docker Certified Associate test with our comprehensive quizzes that include key questions and detailed explanations. Ace your certification!

The command to stop a running Docker container is "docker stop." This command sends a SIGTERM signal to the main process running in the container, allowing it to gracefully terminate. If the container does not stop within a grace period, a SIGKILL signal is sent to forcibly terminate the container. This approach helps ensure that processes can safely close and save any necessary data before they are stopped.

The other options listed do not perform the action of stopping a running container. For instance, "docker halt" is not a valid Docker command, as there's no such command in Docker's CLI. The "docker remove" command is used to delete stopped containers from the host, rather than stopping a running one. Lastly, "docker close" does not exist in Docker's command set and would not be recognized by the Docker CLI. Thus, "docker stop" is the accurate command for halting a container that is currently running.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy