Build container with unprivileged mode in Kubernetes #2554
Comments
|
For now you need to run buildah with a privileged container or at least one running as root. If this is running on a Docker back end, then there could be issues with seccomp preventing the mounts. You probably should use the buildah image or one based on it. quay.io/buildah/stable The main points are to run with --isolation=chroot, since you are already inside of a container. |
|
Thank you for answer. I will look in buildah image, as I understood |
|
Yes, that will only work though, if you pass the /dev/fuse into the container. |
|
@rhatdan so |
|
storage-driver=vfs works without privilege, but has its owne issues. fuse-overlayfs requires /dev/fuse in order to be able to use overlay within a non privileged container (A container without CAP_SYS_ADMIN) |
|
what the issue with |
|
Each layer copies the entire contents of the sublayer. Can take a huge amount of space and be slow. |
|
Hello @rhatdan I switched to
|
|
@alexandrsemak did you ever find a solution to this? I'm getting Also how did you turn on debugging? |
|
@deftdawg nope, We just setup pod in privileged mode where execute inside |
|
I am testing using Buildah today on a kubernetes container in unprivileged mode. Interested to know if anyone has any tips for this. |
|
It is impossible without at least CAP_SETUID and CAP_SETGID. Buildah needs multiple UIDs in order to run. If it pulls an image with more then one UID, then it needs to chown files to this other UID. Most files are probably owned by root, so it needs to be able to write the root files. We can run it within a User Namespace to give us most of the functionality but these containers need to run with CAP_SETUID and CAP_SETGID to setup the user namespace. We are working in the CRI-O world to define how a container/pod can be launched in a user namespace, where Buildah would just work naturally, but this is not possible yet. Bottom line, in a fully locked down, UID !=root system, you can not build images. You can not run with multiple UIDs. |
|
@umohnani8 Another example of building containers within a container. |
|
Hi @rhatdan is there any feature planned for this ? |
|
Not sure what you mean by feature, we plan on writing some articles of different ways you an run buildah and podman inside of containers. |
|
Bottom line Buildah is going to need either a user namespace or to run as root with a few linux capabilities. |
|
@rhatdan Thanks, I thought that it was not possible to have a kubernetes pod with unprivileged buildah container currently ? But from your answer i understand that it's possible, we just need an how to ? |
|
@rhatdan is it possible in few lines to explain us how to do it ? |
|
@umohnani8 Do you have time to play with this next week? |
|
My team is very interested in a solution to this (running as a non-root user). Have tried many settings and options for buildah. Best we can do is the need to sudo chmod 777 /dev/fuse once inside the container and all is well. I'll create a new support case/request/bug for what we are seeing. |
|
@rhatdan @umohnani8 To explain why this issue is very important for us I just want to share my professional context. Our 'build agents' are ephemeral kubernetes pod instanciated just for CI/CD pipelines. For more than 3 years (first version was 0.12) we choose buildah as image builder solution to avoid DinD. It's working but it forced us to make secure the CI/CD context because of privileged pod needed. |
|
@rhatdan any news ? |
|
Nope nothing yet. |
|
@rhatdan ok thanks I will be waiting :-) |
Description
I am trying use buildah for replace docker in jenkins kubernetes plugin which run agent as kubernetes pod for building container.
I can't run
buildah budwith unprivileged modeError:
Steps to reproduce the issue:
Output of
rpm -q buildahorapt list buildah:Output of
buildah version:Output of
cat /etc/*release:Output of
uname -a:Output of
cat /etc/containers/storage.conf:The text was updated successfully, but these errors were encountered: