Signal to stop a container.

Allow to set the signal to stop a container in `docker run`:
- Use `--stop-signal` with docker-run to set the default signal the container will use to exit.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-08-04 13:51:48 -07:00 committed by Tibor Vass
parent 0d2d916b13
commit 36a36bdaf5
7 changed files with 15 additions and 3 deletions

View File

@ -1149,6 +1149,7 @@ _docker_run() {
--publish -p --publish -p
--restart --restart
--security-opt --security-opt
--stop-signal
--ulimit --ulimit
--user -u --user -u
--uts --uts

View File

@ -335,6 +335,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l restart -d 'Res
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l rm -d 'Automatically remove the container when it exits (incompatible with -d)' complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l rm -d 'Automatically remove the container when it exits (incompatible with -d)'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l security-opt -d 'Security Options' complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l security-opt -d 'Security Options'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l sig-proxy -d 'Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.' complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l sig-proxy -d 'Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l stop-signal 'Signal to kill a container'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s t -l tty -d 'Allocate a pseudo-TTY' complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s t -l tty -d 'Allocate a pseudo-TTY'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s u -l user -d 'Username or UID' complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s u -l user -d 'Username or UID'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s v -l volume -d 'Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)' complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s v -l volume -d 'Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)'

View File

@ -502,6 +502,7 @@ __docker_subcommand() {
"($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \
"($help)--rm[Remove intermediate containers when it exits]" \ "($help)--rm[Remove intermediate containers when it exits]" \
"($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \
"($help)--stop-signal[Signal to kill a container]" \
"($help -): :__docker_images" \ "($help -): :__docker_images" \
"($help -):command: _command_names -e" \ "($help -):command: _command_names -e" \
"($help -)*::arguments: _normal" && ret=0 "($help -)*::arguments: _normal" && ret=0

View File

@ -51,6 +51,7 @@ docker-create - Create a new container
[**--read-only**[=*false*]] [**--read-only**[=*false*]]
[**--restart**[=*RESTART*]] [**--restart**[=*RESTART*]]
[**--security-opt**[=*[]*]] [**--security-opt**[=*[]*]]
[**--stop-signal**[=*SIGNAL*]]
[**-t**|**--tty**[=*false*]] [**-t**|**--tty**[=*false*]]
[**-u**|**--user**[=*USER*]] [**-u**|**--user**[=*USER*]]
[**--ulimit**[=*[]*]] [**--ulimit**[=*[]*]]
@ -239,6 +240,9 @@ This value should always larger than **-m**, so you should always use this with
**--security-opt**=[] **--security-opt**=[]
Security Options Security Options
**--stop-signal**=SIGTERM
Signal to stop a container. Default is SIGTERM.
**-t**, **--tty**=*true*|*false* **-t**, **--tty**=*true*|*false*
Allocate a pseudo-TTY. The default is *false*. Allocate a pseudo-TTY. The default is *false*.

View File

@ -180,7 +180,8 @@ To get information on a container use its ID or instance name:
"Memory": 0, "Memory": 0,
"MemorySwap": 0, "MemorySwap": 0,
"CpuShares": 0, "CpuShares": 0,
"Cpuset": "" "Cpuset": "",
"StopSignal": 15,
} }
} }
] ]

View File

@ -53,6 +53,7 @@ docker-run - Run a command in a new container
[**--restart**[=*RESTART*]] [**--restart**[=*RESTART*]]
[**--rm**[=*false*]] [**--rm**[=*false*]]
[**--security-opt**[=*[]*]] [**--security-opt**[=*[]*]]
[**--stop-signal**[=*SIGNAL*]]
[**--sig-proxy**[=*true*]] [**--sig-proxy**[=*true*]]
[**-t**|**--tty**[=*false*]] [**-t**|**--tty**[=*false*]]
[**-u**|**--user**[=*USER*]] [**-u**|**--user**[=*USER*]]
@ -384,6 +385,9 @@ its root filesystem mounted as read only prohibiting any writes.
"label:level:LEVEL" : Set the label level for the container "label:level:LEVEL" : Set the label level for the container
"label:disable" : Turn off label confinement for the container "label:disable" : Turn off label confinement for the container
**--stop-signal**=SIGTERM
Signal to stop a container. Default is SIGTERM.
**--sig-proxy**=*true*|*false* **--sig-proxy**=*true*|*false*
Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is *true*. Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is *true*.