Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

runtime: Implement POSIX platform hooks #34

Open
r10r opened this issue Feb 5, 2021 · 1 comment
Open

runtime: Implement POSIX platform hooks #34

r10r opened this issue Feb 5, 2021 · 1 comment
Assignees

Comments

@r10r
Copy link
Contributor

r10r commented Feb 5, 2021

Implement and test POSIX platform hooks defined by the runtime spec.

https://github.com/opencontainers/runtime-spec/blob/master/config.md#posix-platform-hooks

Most of the OCI hooks could probably simply be mapped to the lxc CONTAINER HOOKS (man lxc.container.conf).

@r10r r10r self-assigned this Feb 5, 2021
@r10r r10r transferred this issue from another repository Mar 24, 2021
@r10r r10r transferred this issue from another repository Apr 8, 2021
@r10r
Copy link
Contributor Author

r10r commented Apr 21, 2021

OCI hooks are implemented as of release v0.11.0

Prestart and CreateRuntime

Prestart and CreateRuntime hooks are executed in the liblxc hooklxc.hook.pre-mount using the lxcri-hook cmd.

lxcri/create.go

Line 366 in cbc79e1

if len(c.Spec.Hooks.Prestart) > 0 || len(c.Spec.Hooks.CreateRuntime) > 0 {

CreateContainer

CreateContainer hooks are executed in the liblxc hook lxc.hook.mount using the lxcri-hook cmd.

lxcri/create.go

Line 371 in cbc79e1

if len(c.Spec.Hooks.CreateContainer) > 0 {

StartContainer

StartContainer hooks run with the same process atrributes (permissions, uid, gid ...) as the container process in lxcri-init,
right before execing the container process:

err = specki.RunHooks(ctx, state, spec.Hooks.StartContainer, false)

Poststart

Poststart hooks run at the end of Runtime.Start in lxcri start.

specki.RunHooks(ctx, &state.SpecState, c.Spec.Hooks.Poststart, true)

Poststop

Poststop hooks run at the end of Runtime.Delete in lxcri delete.

specki.RunHooks(ctx, &state.SpecState, c.Spec.Hooks.Poststop, true)

@r10r r10r pinned this issue Apr 21, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant