Feedback

Chat Icon

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Docker Containers
21%

Sending Signals to Containers

The docker kill command sends a signal to the container's main process (PID 1), which may cause the container to exit depending on how the process handles the signal. By default, the command sends a SIGKILL signal to the containers, but this can be changed by using the --signal option.

The signal can be specified either by name (e.g., SIGKILL) or by its numeric signal number (e.g., 9 for SIGKILL, 15 for SIGTERM). Signal numbers are defined by the operating system's signal implementation - consult man 7 signal or run kill -l to list available signals and numbers on your system.

Here is an example of how to use the docker kill command:

docker kill [OPTIONS] CONTAINER [CONTAINER...]

The default signal, SIGKILL, is equivalent to using the kill -9 command in Linux, which forcefully terminates a process without allowing it to clean up. Alternatively, you can use the SIGINT

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $31.99$25.59

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More