Skip to content
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

support PostExit Hook #1182

Open
fahedouch opened this issue Feb 14, 2023 · 11 comments
Open

support PostExit Hook #1182

fahedouch opened this issue Feb 14, 2023 · 11 comments

Comments

@fahedouch
Copy link

fahedouch commented Feb 14, 2023

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

@AkihiroSuda
Copy link
Member

Did you mean "exist" or "exit" ?

@AkihiroSuda
Copy link
Member

And how would it be different from poststop hooks?

@fahedouch
Copy link
Author

@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

@AkihiroSuda
Copy link
Member

PostExit should be called after the container exit

How implementable?

@fahedouch
Copy link
Author

fahedouch commented Feb 14, 2023

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.

@AkihiroSuda
Copy link
Member

An OCI runtime process disappears on exec(2)-ing the container process, so I'm not sure how this proposal is implementable.

@fahedouch
Copy link
Author

@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
Copy link
Member

@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

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 runc process once the container has started. In fact, there is no
long-running runc process at all.

@fahedouch
Copy link
Author

@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

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 runc process once the container has started. In fact, there is no
long-running runc process at all.

got the point. Do we have a hook mechanism into containerd that may catch container exit ?

@AkihiroSuda
Copy link
Member

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.

@fahedouch
Copy link
Author

opened ticket containerd/containerd#8163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants