oci-hooks(5) Configuration oci-hooks(5) W. Trevor King MAY 2018 (NAME) oci-hooks - (hooks) OCI (SYNOPSIS) /usr/share/containers/oci/hooks.d/*.json (DESCRIPTION) << >> (Open Container Initiative) . (DIRECTORIES) JSON ( .json) . /usr/share/containers/oci/hooks.d . JSON (mask ). /etc/containers/oci/hooks.d /usr/share/containers/oci/hooks.d ( ) /etc/containers/oci/hooks.d/01-my- hook.json /usr/share/containers/oci/hooks.d/01-my-hook.json . JSON . . /etc/containers/oci/hooks.d /usr/share/containers/oci/hooks.d ( ) /etc/containers/oci/hooks.d/01-my-hook.json /usr/share/containers/oci/hooks.d/01-my- hook.json . /usr/share/containers/oci/hooks.d/01-my-hook.json /etc/containers/oci/hooks.d/01-my-hook.json . /etc/containers/oci/hooks.d/01-my-hook.json /usr/share/containers/oci/hooks.d/01-my-hook.json . JSON . 01-my-hook.json 02-another-hook.json 01-UPPERCASE.json . ( 01/02 ) . JSON (schemas) . .. (1.0.0 Hook Schema) version ( ) . 1.0.0 . hook ( ) OCI 1.0.2. when ( ) . : o always ( ) true . o annotations ( ) / annotations / . POSIX . o commands ( ) process.args[0] . POSIX . o hasBindMounts ( ) hasBindMounts true (bind mounts) . stages ( ) . OCI 1.0.2 . when hook stages . .. (0.1.0 Hook Schema) hook ( ) path . arguments ( ) . args hook arguments . stages ( ) . stage stages stage . OCI 1.0.2 . cmds ( ) process.args[0] . cmd cmds cmd . POSIX . annotations ( ) annotations . annotation annotations annotation . POSIX . hasbindmounts ( ) hasBindMounts true . (EXAMPLES) .. oci-systemd-hook (pre-start) (post-stop) process.args[0] /init /systemd : $ cat /etc/containers/oci/hooks.d/oci-systemd-hook.json { "version": "1.0.0", "hook": { "path": "/usr/libexec/oci/hooks.d/oci-systemd-hook" }, "when": { "commands": [".*/init$" , ".*/systemd$"] }, "stages": ["prestart", "poststop"] } (bind-mount) oci- umount --debug . $ cat /etc/containers/oci/hooks.d/oci-umount.json { "version": "1.0.0", "hook": { "path": "/usr/libexec/oci/hooks.d/oci-umount", "args": ["oci-umount", "--debug"], }, "when": { "hasBindMounts": true }, "stages": ["prestart"] } nvidia-container-runtime-hook prestart annotations ^com\.example\.department$ .*fluid-dynamics.* . $ cat /etc/containers/oci/hooks.d/nvidia.json { "version": "1.0.0", "hook": { "path": "/usr/sbin/nvidia-container-runtime-hook", "args": ["nvidia-container-runtime-hook", "prestart"], "env": [ "NVIDIA_REQUIRE_CUDA=cuda>=9.1", "NVIDIA_VISIBLE_DEVICES=GPU-fef8089b" ] }, "when": { "annotations": { "^com\\.example\\.department$": ".*fluid-dynamics$" } }, "stages": ["prestart"] } .. process.args[0] /init /systemd oci-systemd-hook pre-start post-stop : $ cat /etc/containers/oci/hooks.d/oci-systemd-hook.json { "cmds": [".*/init$" , ".*/systemd$"], "hook": "/usr/libexec/oci/hooks.d/oci-systemd-hook", "stages": ["prestart", "poststop"] } oci-umount --debug . $ cat /etc/containers/oci/hooks.d/oci-umount.json { "hook": "/usr/libexec/oci/hooks.d/oci-umount", "arguments": ["--debug"], "hasbindmounts": true, "stages": ["prestart"] } annotations .*fluid-dynamics.* nvidia-container-runtime-hook prestart . $ cat /etc/containers/oci/hooks.d/osystemd-hook.json { "hook": "/usr/sbin/nvidia-container-runtime-hook", "arguments": ["prestart"], "annotations: [".*fluid-dynamics.*"], "stages": ["prestart"] } (SEE ALSO) oci-systemd-hook(1), oci-umount(1), locale(7) o OCI Runtime Specification, 1.0.2, POSIX-platform hooks o OCI Runtime Specification, 1.0.2, process o POSIX extended regular expressions (EREs) Hooks OCI oci-hooks(5)