mirror of https://github.com/docker/cli.git
				
				
				
			Add `STOPSIGNAL` instruction to dockerfiles.
This way, images creators can set the exit signal their programs use. Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
		
							parent
							
								
									36a36bdaf5
								
							
						
					
					
						commit
						f5b80326a1
					
				| 
						 | 
					@ -158,6 +158,7 @@ the `Dockerfile`:
 | 
				
			||||||
* `USER`
 | 
					* `USER`
 | 
				
			||||||
* `WORKDIR`
 | 
					* `WORKDIR`
 | 
				
			||||||
* `VOLUME`
 | 
					* `VOLUME`
 | 
				
			||||||
 | 
					* `STOPSIGNAL`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
as well as:
 | 
					as well as:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1012,6 +1013,14 @@ For example you might add something like this:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> **Warning**: The `ONBUILD` instruction may not trigger `FROM` or `MAINTAINER` instructions.
 | 
					> **Warning**: The `ONBUILD` instruction may not trigger `FROM` or `MAINTAINER` instructions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## STOPSIGNAL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						STOPSIGNAL signal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `STOPSIGNAL` instruction sets the system call signal that will be sent to the container to exit.
 | 
				
			||||||
 | 
					This signal can be a valid unsigned number that matches a position in the kernel's syscall table, for instance 9,
 | 
				
			||||||
 | 
					or a signal name in the format SIGNAME, for instance SIGKILL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Dockerfile examples
 | 
					## Dockerfile examples
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Nginx
 | 
					    # Nginx
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,6 +61,7 @@ Creates a new container.
 | 
				
			||||||
      --read-only=false             Mount the container's root filesystem as read only
 | 
					      --read-only=false             Mount the container's root filesystem as read only
 | 
				
			||||||
      --restart="no"                Restart policy (no, on-failure[:max-retry], always, unless-stopped)
 | 
					      --restart="no"                Restart policy (no, on-failure[:max-retry], always, unless-stopped)
 | 
				
			||||||
      --security-opt=[]             Security options
 | 
					      --security-opt=[]             Security options
 | 
				
			||||||
 | 
					      --stop-signal="SIGTERM"       Signal to stop a container
 | 
				
			||||||
      -t, --tty=false               Allocate a pseudo-TTY
 | 
					      -t, --tty=false               Allocate a pseudo-TTY
 | 
				
			||||||
      --disable-content-trust=true  Skip image verification
 | 
					      --disable-content-trust=true  Skip image verification
 | 
				
			||||||
      -u, --user=""                 Username or UID
 | 
					      -u, --user=""                 Username or UID
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,6 +62,7 @@ weight=1
 | 
				
			||||||
      --restart="no"                Restart policy (no, on-failure[:max-retry], always, unless-stopped)
 | 
					      --restart="no"                Restart policy (no, on-failure[:max-retry], always, unless-stopped)
 | 
				
			||||||
      --rm=false                    Automatically remove the container when it exits
 | 
					      --rm=false                    Automatically remove the container when it exits
 | 
				
			||||||
      --security-opt=[]             Security Options
 | 
					      --security-opt=[]             Security Options
 | 
				
			||||||
 | 
					      --stop-signal="SIGTERM"       Signal to stop a container
 | 
				
			||||||
      --sig-proxy=true              Proxy received signals to the process
 | 
					      --sig-proxy=true              Proxy received signals to the process
 | 
				
			||||||
      -t, --tty=false               Allocate a pseudo-TTY
 | 
					      -t, --tty=false               Allocate a pseudo-TTY
 | 
				
			||||||
      -u, --user=""                 Username or UID (format: <name|uid>[:<group|gid>])
 | 
					      -u, --user=""                 Username or UID (format: <name|uid>[:<group|gid>])
 | 
				
			||||||
| 
						 | 
					@ -531,3 +532,9 @@ containers with `daemon` user:
 | 
				
			||||||
The 4th container fails and reports "[8] System error: resource temporarily unavailable" error. 
 | 
					The 4th container fails and reports "[8] System error: resource temporarily unavailable" error. 
 | 
				
			||||||
This fails because the caller set `nproc=3` resulting in the first three containers using up 
 | 
					This fails because the caller set `nproc=3` resulting in the first three containers using up 
 | 
				
			||||||
the three processes quota set for the `daemon` user.
 | 
					the three processes quota set for the `daemon` user.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Stopping a container with a specific signal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `--stop-signal` flag sets the system call signal that will be sent to the container to exit.
 | 
				
			||||||
 | 
					This signal can be a valid unsigned number that matches a position in the kernel's syscall table, for instance 9,
 | 
				
			||||||
 | 
					or a signal name in the format SIGNAME, for instance SIGKILL.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -181,7 +181,7 @@ To get information on a container use its ID or instance name:
 | 
				
			||||||
        "MemorySwap": 0,
 | 
					        "MemorySwap": 0,
 | 
				
			||||||
        "CpuShares": 0,
 | 
					        "CpuShares": 0,
 | 
				
			||||||
        "Cpuset": "",
 | 
					        "Cpuset": "",
 | 
				
			||||||
        "StopSignal": 15,
 | 
					        "StopSignal": "SIGTERM"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue