What command is used to stop a running Docker container?

Prepare for the Docker Server Test with interactive quizzes. Study with flashcards and multiple choice questions. Each question includes hints and explanations. Enhance your Docker knowledge and ace your test!

The command used to stop a running Docker container is "docker stop." This command gracefully stops a container by sending a SIGTERM signal to the primary process running inside the container, allowing it to clean up resources and shut down properly. If the process does not terminate within a grace period (default is 10 seconds), Docker will then send a SIGKILL signal to forcibly stop the container.

This approach is important for maintaining data integrity and ensuring that applications can complete current operations or save states before shutting down. It differs from other commands like "docker kill," which immediately stops the container without waiting for the application to terminate, and it contrasts with commands like "docker exit," which is not a Docker command used for stopping containers. "Docker halt" is also not a valid command, as it's more relevant in other contexts such as stopping virtual machines.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy