rootless: prevent the service hanging when stopping (set systemd KillMode to mixed)#41947
Conversation
Now `systemctl --user stop docker` completes just with in 1 or 2 seconds.
Fix issue 41944 ("Docker rootless does not exit properly if containers are running")
See systemd.kill(5) https://www.freedesktop.org/software/systemd/man/systemd.kill.html
Signed-off-by: Akihiro Suda <[email protected]>
| TasksMax=infinity | ||
| Delegate=yes | ||
| Type=simple | ||
| KillMode=mixed |
There was a problem hiding this comment.
Does/should rootless mode support "live-restore"? ISTR we use "process" in the regular systemd unit because of that; https://github.com/docker/docker-ce-packaging/blob/master/systemd/docker.service#L43
There was a problem hiding this comment.
No, at least for now
There was a problem hiding this comment.
"process" does seem more correct eventually, but mixed sounds good for now 👍
|
Minor nitpick: the changelog entry should describe what is done, not how it's done. E.g.:
|
|
updated PR description, thanks for suggestion |
|
s390x failure is unrelated; rootless CI is green. I consider it not worth restarting CI for that |
|
Thanks! |
|
This was not included in v20.10.3. Proposing to v20.10.4 in #41956. |
The service was not stopping correctly when containers are running. See upstream: - moby/moby#41944 - moby/moby#41947
- What I did
Fix #41944 ("Docker rootless does not exit properly if containers are running")
Now
systemctl --user stop dockercompletes just with in 1 or 2 seconds.- How I did it
Changed the KillMode from "control-group" (default) to "mixed"
See systemd.kill(5) https://www.freedesktop.org/software/systemd/man/systemd.kill.html
"mixed" is available since systemd 209 (2014-02-20) https://github.com/systemd/systemd/blob/57353d2909e503e3e5c7e69251ba95a31e1a72ce/NEWS#L9318
- How to verify it
Run some containers with rootless, and make sure
systemctl --user stop docker.servicecompletes in a few seconds.$ docker --context=rootless run --name nginx -d -p 8080:80 --restart=always nginx:alpine $ time systemctl --user stop docker real 0m1.266s user 0m0.005s sys 0m0.000s- Description for the changelog
rootless: prevent the service hanging when stopping (set systemd KillMode to mixed)
- A picture of a cute animal (not mandatory but encouraged)
🐧