mirror of
https://github.com/phusion/baseimage-docker.git
synced 2026-03-28 13:28:10 +00:00
Merge pull request #385 from jsravn/fix-kill-timeouts
Fix kill timeouts
This commit is contained in:
16
README.md
16
README.md
@@ -201,6 +201,22 @@ In `Dockerfile`:
|
||||
RUN chmod +x /etc/my_init.d/logtime.sh
|
||||
|
||||
<a name="environment_variables"></a>
|
||||
|
||||
#### Shutting down your process
|
||||
|
||||
`/sbin/my_init` handles termination of children processes at shutdown. When it receives a SIGTERM
|
||||
it will pass the signal onto the child processes for correct shutdown. If your process is started with
|
||||
a shell script, make sure you `exec` the actual process, otherwise the shell will receive the signal
|
||||
and not your process.
|
||||
|
||||
`/sbin/my_init` will terminate processes after a 5 second timeout. This can be adjusted by setting
|
||||
environment variables:
|
||||
|
||||
# Give children processes 5 minutes to timeout
|
||||
ENV KILL_PROCESS_TIMEOUT=300
|
||||
# Give all other processes (such as those which have been forked) 5 minutes to timeout
|
||||
ENV KILL_ALL_PROCESSES_TIMEOUT=300
|
||||
|
||||
### Environment variables
|
||||
|
||||
If you use `/sbin/my_init` as the main container command, then any environment variables set with `docker run --env` or with the `ENV` command in the Dockerfile, will be picked up by `my_init`. These variables will also be passed to all child processes, including `/etc/my_init.d` startup scripts, Runit and Runit-managed services. There are however a few caveats you should be aware of:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/python3 -u
|
||||
import os, os.path, sys, stat, signal, errno, argparse, time, json, re
|
||||
|
||||
KILL_PROCESS_TIMEOUT = os.environ.get('KILL_PROCESS_TIMEOUT', 5)
|
||||
KILL_ALL_PROCESSES_TIMEOUT = os.environ.get('KILL_ALL_PROCESSES_TIMEOUT', 5)
|
||||
KILL_PROCESS_TIMEOUT = int(os.environ.get('KILL_PROCESS_TIMEOUT', 5))
|
||||
KILL_ALL_PROCESSES_TIMEOUT = int(os.environ.get('KILL_ALL_PROCESSES_TIMEOUT', 5))
|
||||
|
||||
LOG_LEVEL_ERROR = 1
|
||||
LOG_LEVEL_WARN = 1
|
||||
|
||||
Reference in New Issue
Block a user