is it possible to use hooks to modify content on container disk before the build steps are executed? #5144
-
I am trying to provide a CI/CD capability for other developers in an organisation which is air gapped and want to remove "headaches" in configuration for developers. For example i would like to ensure every container that is being built from a dockerfile that the developers do not need to include configuration details to get package managers working when building inside the CI/CD network, this will be things along the lines of modifying files ideally with a script to "sed" changes into files and setting environment variables. The buildah configuration file can help me achieve these things however i know for many developers who aren't across something like buildah, allowing someone to design an includable template that runs defines and runs a hook script before the container starts the build steps allows someone to pre layout a file configuration before. TL;DR |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
i am able to get it running from a linux VM with buildah installed. However when using the buildah image quay.io/buildah/stable:latest it does not work. FROM node:latest
RUN ls /tmp hook file {
"version": "1.0.0",
"hook": {
"path": "/usr/bin/touch",
"args": ["touch", "/tmp/hook-file"]
},
"when": {
"always": true
},
"stages": ["startContainer"]
} run command buildah build --hooks-dir="$(pwd)/hooks" --no-cache -f ./dockerfile -t testing . Debug logs show it gets added as a hook in the container but never executed. Is something configured to skip hooks from the container? |
Beta Was this translation helpful? Give feedback.
when we use buildah inside a container, we are likely using the "chroot" execution model that doesn't honor hooks. You should use "oci" that uses a real OCI runtime to run the command, but you might need to relax the security constraints for your environment