github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/container_kill.md (about)

     1  # kill
     2  
     3  <!---MARKER_GEN_START-->
     4  Kill one or more running containers
     5  
     6  ### Aliases
     7  
     8  `docker container kill`, `docker kill`
     9  
    10  ### Options
    11  
    12  | Name                                   | Type     | Default | Description                     |
    13  |:---------------------------------------|:---------|:--------|:--------------------------------|
    14  | [`-s`](#signal), [`--signal`](#signal) | `string` |         | Signal to send to the container |
    15  
    16  
    17  <!---MARKER_GEN_END-->
    18  
    19  ## Description
    20  
    21  The `docker kill` subcommand kills one or more containers. The main process
    22  inside the container is sent `SIGKILL` signal (default), or the signal that is
    23  specified with the `--signal` option. You can reference a container by its
    24  ID, ID-prefix, or name.
    25  
    26  The `--signal` flag sets the system call signal that is sent to the container.
    27  This signal can be a signal name in the format `SIG<NAME>`, for instance `SIGINT`,
    28  or an unsigned number that matches a position in the kernel's syscall table,
    29  for instance `2`.
    30  
    31  While the default (`SIGKILL`) signal will terminate the container, the signal
    32  set through `--signal` may be non-terminal, depending on the container's main
    33  process. For example, the `SIGHUP` signal in most cases will be non-terminal,
    34  and the container will continue running after receiving the signal.
    35  
    36  > **Note**
    37  >
    38  > `ENTRYPOINT` and `CMD` in the *shell* form run as a child process of
    39  > `/bin/sh -c`, which does not pass signals. This means that the executable is
    40  > not the container’s PID 1 and does not receive Unix signals.
    41  
    42  ## Examples
    43  
    44  
    45  ### Send a KILL signal to a container
    46  
    47  The following example sends the default `SIGKILL` signal to the container named
    48  `my_container`:
    49  
    50  ```console
    51  $ docker kill my_container
    52  ```
    53  
    54  ### <a name="signal"></a> Send a custom signal to a container (--signal)
    55  
    56  The following example sends a `SIGHUP` signal to the container named
    57  `my_container`:
    58  
    59  ```console
    60  $ docker kill --signal=SIGHUP  my_container
    61  ```
    62  
    63  
    64  You can specify a custom signal either by _name_, or _number_. The `SIG` prefix
    65  is optional, so the following examples are equivalent:
    66  
    67  ```console
    68  $ docker kill --signal=SIGHUP my_container
    69  $ docker kill --signal=HUP my_container
    70  $ docker kill --signal=1 my_container
    71  ```
    72  
    73  Refer to the [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html)
    74  man-page for a list of standard Linux signals.