-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
185 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
If this 'systemctl' is run without arguments | ||
then it will default to "list-units". | ||
|
||
## systemctl as init process | ||
|
||
However... if systemctl is PID 1 then it will | ||
run "1" which does both "default" and "wait". | ||
So it will start all services in the default | ||
target of "multi-user.target", it will then | ||
wait for any child to be reaped. And when a | ||
SIGTERM (aka "docker stop") is received then | ||
it will stop all services in the default | ||
target of "multi-user.target". | ||
|
||
As recommendations, you may try to run | ||
|
||
docker run --name running image /usr/bin/systemctl | ||
|
||
and later | ||
|
||
docker stop --time 100 running | ||
|
||
Note that run does have a "--stop-timeout 100" in | ||
later versions corresponding to docker-compse | ||
stop_grace_period setting. In most cases the default | ||
of 10 seconds is to short to bring down all services | ||
correctly. Make it atleast 100 if you know that this | ||
systemctl replacement is run as PID 1 .. i.e. as a | ||
"init" process replacement. | ||
|
||
You may force the docker-systemctl-replacement to | ||
run as the init replacement simply by saying | ||
|
||
/usr/bin/systemctl 1 | ||
|
||
which is identical to | ||
|
||
/usr/bin/systemctl default | ||
/usr/bin/systemctl wait | ||
|
||
The handling of SIGTERM in "wait" is to call "halt" | ||
which may also be issued manually to bring down | ||
all services: | ||
|
||
/usr/bin/systemctl halt | ||
|
||
The systemctl commands "default" and "halt" are matching | ||
those from the original, while "wait" is an innovation. |
Oops, something went wrong.