support PostExit Hook
What is the problem I am trying to solve ?
Looking at the list of supported hooks, we are missing a hooks for configuring custom actions related to the exit lifecycle ( i.e normal exist / killing a container ..)
In nerdctl project, we need a hooks to deal with container deps when the container exit, such as cleaning some state files.
Describe the solution
add new hook PostExit to the hooks list
Did you mean "exist" or "exit" ?
And how would it be different from poststop hooks?
@AkihiroSuda
Did you mean "exist" or "exit" ?
Yes exit
And how would it be different from poststop hooks?
poststop hook is called after the container is deleted but before the delete operation returns.
PostExit should be called after the container exit
PostExit should be called after the container exit
How implementable?
PostExit should be called after the container exit
How implementable?
did not get your question ? You mean how to introduce a runtime implementation. If yes I believe that we can easily do this in runc for example, but I have to dig into before answering this question.
An OCI runtime process disappears on exec(2)-ing the container process, so I'm not sure how this proposal is implementable.
@AkihiroSuda would please give me more details about exec(2)-ing the container process or may be link code or article around this. I am looking for an entrypoint to understand what are saying. thanks
@AkihiroSuda would please give me more details about
exec(2)-ing the container processor may be link code or article around this. I am looking for an entrypoint to understand what are saying. thanks
https://github.com/opencontainers/runc/blob/v1.1.4/docs/terminals.md#detached
In contrast to foreground mode, in detached mode there is no long-running foreground
runcprocess once the container has started. In fact, there is no long-runningruncprocess at all.
@AkihiroSuda would please give me more details about
exec(2)-ing the container processor may be link code or article around this. I am looking for an entrypoint to understand what are saying. thankshttps://github.com/opencontainers/runc/blob/v1.1.4/docs/terminals.md#detached
In contrast to foreground mode, in detached mode there is no long-running foreground
runcprocess once the container has started. In fact, there is no long-runningruncprocess at all.
got the point. Do we have a hook mechanism into containerd that may catch container exit ?
Do we have a hook mechanism into containerd that may catch container exit ?
Feel free to submit a proposal in the containerd repo. Maybe we can extend its restart monitor plugin.
opened ticket https://github.com/containerd/containerd/issues/8163