Open djrenren opened 2 years ago
I've been experiencing this issue for years, finally had some inspiration to do something about it:
cat << EOF > ~/.config/systemd/user/stop-toolbox-containers.service
[Unit]
Description=Stop all Toolbox containers on shutdown
[Service]
ExecStop=/usr/bin/podman stop --all --filter "label=com.github.containers.toolbox=true"
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now stop-toolbox-containers.service
I do think this should be properly handled by the toolbx
itself. Maybe whatever is preventing containers from stopping can be fixed or this service can be incorporated into the toolbox package.
@debarshiray what do you think?
Describe the bug If you have an active toolbox session and you try to reboot the host machine, the container will refuse to shutdown. Eventually it will timeout and systemd will forcibly kill the process.
Steps how to reproduce the behavior
toolbox enter my-container
Expected behaviour The container should gracefully shutdown and shutdown should work.
Actual behaviour Wait for systemd to SIGKILL the container process.
Output of
toolbox --version
(v0.0.90+)Toolbox package info (
rpm -q toolbox
)Output of
podman version
Podman package info (
rpm -q podman
)Info about your OS ArchLinux (as of Jan. 21, 2022)
Additional context I can reproduce the issue using either of these images: