瀏覽代碼

Add a note about PID 1 not terminating on SIGINT/SIGTERM.
Also re-arranged the description of CTRL-c to make it clearer.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Bryan Boreham 10 年之前
父節點
當前提交
5ad15479a0
共有 2 個文件被更改,包括 15 次插入4 次删除
  1. 10 4
      docs/sources/reference/commandline/cli.md
  2. 5 0
      docs/sources/reference/run.md

+ 10 - 4
docs/sources/reference/commandline/cli.md

@@ -516,10 +516,16 @@ interactively.  You can attach to the same contained process multiple times
 simultaneously, screen sharing style, or quickly view the progress of your
 simultaneously, screen sharing style, or quickly view the progress of your
 daemonized process.
 daemonized process.
 
 
-You can detach from the container (and leave it running) with `CTRL-p CTRL-q`
-(for a quiet exit) or `CTRL-c` which will send a `SIGKILL` to the container.
-When you are attached to a container, and exit its main process, the process's
-exit code will be returned to the client.
+You can detach from the container and leave it running with `CTRL-p
+CTRL-q` (for a quiet exit) or with `CTRL-c` if `--sig-proxy` is false.
+
+If `--sig-proxy` is true (the default),`CTRL-c` sends a `SIGINT`
+to the container.
+
+>**Note**: A process running as PID 1 inside a container is treated
+>specially by Linux: it ignores any signal with the default action.
+>So, the process will not terminate on `SIGINT` or `SIGTERM` unless it is
+>coded to do so.
 
 
 It is forbidden to redirect the standard input of a `docker attach` command while
 It is forbidden to redirect the standard input of a `docker attach` command while
 attaching to a tty-enabled container (i.e.: launched with `-t`).
 attaching to a tty-enabled container (i.e.: launched with `-t`).

+ 5 - 0
docs/sources/reference/run.md

@@ -111,6 +111,11 @@ as you'll see in later examples.  Specifying `-t` is forbidden when the client
 standard output is redirected or piped, such as in:
 standard output is redirected or piped, such as in:
 `echo test | docker run -i busybox cat`.
 `echo test | docker run -i busybox cat`.
 
 
+>**Note**: A process running as PID 1 inside a container is treated
+>specially by Linux: it ignores any signal with the default action.
+>So, the process will not terminate on `SIGINT` or `SIGTERM` unless it is
+>coded to do so.
+
 ## Container identification
 ## Container identification
 
 
 ### Name (--name)
 ### Name (--name)