On Mon, Feb 22, 2021 at 3:41 PM boardbill_unpretended--- via Podman <
podman(a)lists.podman.io> wrote:
Good news! The issue disappeared after I removed the
`oci-systemd-hook`
and `oci-systemd-hook.json` files.
Thank you Valentin!! :D
Excellent, glad I could help.
I've got more questions about Podman as I continue to learn about
it which
probably belong in new threads. But there is one follow up to this thread:
The idea of hooks sound interesting. Is there good documentation for how
they work for Podman and how I can set up hooks?
Yes, there's a man page `man oci-hooks` [1]. OCI hooks per specification
will run unconditionally, so we introduced a kind of wrapper around them to
make them more configurable.
An initial Internet search did not give me a clear result. For
example, if
I want a clean up script to run inside the container *as it is stopping*,
what should I do? Let's say I have that script, how do I pass it to Podman
when I start a container and tell Podman to "hook" it so that the script
runs as the container beginning to stop (when I run `podman stop [container
ID]`)?
I do not know a way to do that by means of runtime hooks. There's a
"poststop" stage but you'd need a "prestart" stage. What you
could do
instead is to have a script running inside your container that installs a
signal handler for SIGTERM. This signal is sent when stopping a container
(or during kill before shooting with SIGKILL).
And can I conditionally set hooks to only run for certain containers?
Yes, you can do that. We employ a trick like that for the
oci-seccomp-bpf-hook [1], where we're passing down an *annotation* that
JSOn config of the hook is looking for. This way, the hook will only be
fired when the container has the specific annotation.
[1]
https://github.com/containers/podman/blob/master/pkg/hooks/docs/oci-hooks...
[2]
https://github.com/containers/oci-seccomp-bpf-hook
[3]
https://github.com/containers/oci-seccomp-bpf-hook/blob/master/oci-seccom...
> Thanks again! Really appreciate your help, I'll probably start another
> thread or two with other problems I've encountered.
> _______________________________________________
> Podman mailing list -- podman(a)lists.podman.io
> To unsubscribe send an email to podman-leave(a)lists.podman.io