-
Notifications
You must be signed in to change notification settings - Fork 788
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
[FEATURE REQUEST]: oci hook for RUN instruction #4068
Comments
Hi @lukasmrtvy , Thanks for creating the issue i'll take a look at this. |
Upon checking this again the stage which you requested What would be the use-case of this new stage if its meant to be executed in So Edit: or do you want equivalent to |
@flouthoc hey, thanks Lets say that I want to restrict outbound connections from build to private ranges defined by RFC ( except local DNS server ofc ). Should be doable to create a bridge ( and set iptables rules for this interface ) and use this bridge for container builds, but still, all builds are not isolated between themselves. It's the same case as --userns=auto, this one applies to networking. And yes, for running container, I am using containerCreate stage which exists, but it would make a sense to have a specific stage for containerBuild Does it make sense ? Thanks |
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
@lukasmrtvy Added above feature in #4071 but instead of adding a new stage I think we can keep using existing stages for buildah and you can further restrict usage using annotation. The reason i am not in favor of adding a new stage is because it does not states the behavior of the hook i.e when will it get executed and why was this stage crated if stages for all possible points already exists like An example test in #4071 should help. But i'm also fine to introduce a new stage if maintainers agree with it :) Thanks |
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
This should work through the OCI specification, not a buildah only requirement. |
I read this request as asking for a new option. We should support standard OCI Hooks though. |
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
Following PR adds support for OCI hooks attached to each of ephemeral build contains which are created by `RUN` step invoked during `buildah build` command. Following PR also adds `--hooks-dir` flag to `buildah build` option which allows end-users to specify one or more configuration directories for OCI-hooks. Note: Following PR migrates `pkg/hooks` from `podman` to `buildah` so buildah could implement this feature and once merged `podman` can start using `buildah/pkg/hooks`. For usage see man-page and example test-case. See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Closes: containers#4068 Signed-off-by: Aditya R <[email protected]>
I am trying this implementation in Podman 4.2.0. Seems its working via CLI, but API call does not work. Dockerfile
OCI hook ( script )
OCI hook
Works correctly via CLI
Does not work via CLI
|
@lukasmrtvy ackd i'll check this. |
@lukasmrtvy This is not implemented for remote, since files hook access is present on the host, so client invoking this cannot expect One thing which can be done is that client expects that hook script is present on host then we can wire on API end and make ii work ( if that is what you want ) ? |
@lukasmrtvy SGTM, this looks like a feature instead of a bug and following PR should close it containers/podman#15522 |
I am not familiar with the exact relation between the build phase and runc/crun, but I believe We are missing some custom oci hook stage for RUN instruction which will help us trigger for example custom iptable rules.
This one is useful with a combination of already implemented --userns=auto parameter #4060.
Use case:
Snippet:
Possible workaround:
, but it comes with an additional performance and time penalty ( load image to local registry )
Thanks
The text was updated successfully, but these errors were encountered: