-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trap the sigterm during the stop of a container #142
Comments
Unfortunately it's not possible to catch SIGKILL at all on Linux. There's not really anything dumb-init (or any init system) can do to help here. If dumb-init gets SIGKILL, the kernel will always immediately kill it. |
Hi, thanks for the reply. My bad it was not a sigkill but a sigterm. The process is kill with the -9. I just want to do a graceful kill of keepalived during the stop of the container. If i do manualy pkill keepalived and after that i stop the container, everything was fine. |
Note that |
Yes, but when i stop my container, the process keepalived is not stop with SIGTERM. So i need to sigterm keepalived and after that stop my container. I want to script that part in the container. |
Which command are you using to stop your docker container currently? I'm seeing SIGTERM passed to children: FROM ckuehl/dumb-init:ubuntu-trusty
ENTRYPOINT ["dumb-init", "-v", "--"]
|
@asottile brings up a good idea too -- it'd be useful to add "--verbose" to your dumb-init command and then see what gets printed. That would help us debug what's happening here. |
Note that made a docker_exec bash script to handle sigterm in containers |
@ErwanAliasr1 I didn't have the idea to override the exec function. Really nice. And again. Thank you. Works really great! |
@devTechi thanks for the feedback, glad it helped some |
@devTechi You can consider looking at the latest version of it if you like it : https://github.com/ceph/ceph-container/blob/master/src/daemon/docker_exec.sh |
Thanks again. I really do like it. I don't think, that I need the updated version. I just need to handle every SIGNAL I want in a signle function, but who knows. May this will change tomorrow (or even today 😅 ) |
Hi,
I would like to know if with dumb-init it's possible to trap the sigkill to be able to do something else during the stop of the container ?
I used keepalived and two process was created but the second one doesn't have the pid 1 for parent so it's not killed correctly.
root 7711 1 0 18:15 ? 00:00:00 keepalived -P xxx
root 7714 7711 0 18:15 ? 00:00:00 keepalived -P xxx
Regards,
The text was updated successfully, but these errors were encountered: