Controlling Docker containers

So far, we have discussed a few practical examples to clearly articulate the nitty-gritty of Docker containers. In this section, we'll introduce a few basic as well as a few advanced command structures for meticulously illustrating how the Docker containers can be managed.

The Docker Engine enables you to start, stop, and restart a container with a set of docker subcommands. Let's begin with the docker stop subcommand, which stops a running container. When a user issues this command, the Docker Engine sends SIGTERM (-15) to the main process, which is running inside the container. The SIGTERM signal requests the process to terminate itself gracefully. Most processes would handle this signal and facilitate a graceful ...

Get Learning Docker - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.