Replies: 1 comment 4 replies
-
First does the Jenkins user have 165k UIDs defined within its container? The container you are running podman in, has to have enough UIDs to handle the user namespace within the container. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I hope this message finds you well.
I am encountering an issue while trying to run Podman commands inside a container as the jenkins user. The goal is to execute these commands without requiring root privileges. However, I am receiving the following error message:
vbnet
Copy code
Error: cannot set up namespace using "/usr/bin/newuidmap": exit status 1
newuidmap: open of uid_map failed: Permission denied
I have ensured that the jenkins user has the correct entries in both /etc/subuid and /etc/subgid:
/etc/subuid: jenkins:100000:65536
/etc/subgid: jenkins:100000:65536
Despite this configuration, the error persists. I’ve also tried setting the necessary capabilities for newuidmap and newgidmap using the following commands, but without success:
bash
Copy code
sudo setcap cap_setuid+ep /usr/bin/newuidmap
sudo setcap cap_setgid+ep /usr/bin/newgidmap
I am seeking assistance in resolving this issue, as the main objective is to run Podman commands as the jenkins user without requiring root access.
Any advice or guidance you could provide would be greatly appreciated.
this is the error message-
INFO[0000] podman filtering at log level debug
DEBU[0000] Called login.PersistentPreRunE(podman --log-level=debug login golem.ilntsur.loc:48444)
DEBU[0000] Merged system config "/usr/share/containers/containers.conf"
DEBU[0000] Failed to decode the keys ["network_backend" "unqualified-search-registries"] from "/home/jenkins/.config/containers/containers.conf".
DEBU[0000] Merged system config "/home/jenkins/.config/containers/containers.conf"
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /home/jenkins/.local/share/containers/storage/libpod/bolt_state.db
DEBU[0000] Using graph driver vfs
DEBU[0000] Using graph root /home/jenkins/.local/share/containers/storage
DEBU[0000] Using run root /tmp/podman-run-1000/containers
DEBU[0000] Using static dir /home/jenkins/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /tmp/podman-run-1000/libpod/tmp
DEBU[0000] Using volume path /home/jenkins/.local/share/containers/storage/volumes
DEBU[0000] Set libpod namespace to ""
DEBU[0000] Not configuring container store
DEBU[0000] Initializing event backend file
DEBU[0000] Configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] Configured OCI runtime runj initialization failed: no valid executable found for OCI runtime runj: invalid argument
DEBU[0000] Configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] Configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Configured OCI runtime krun initialization failed: no valid executable found for OCI runtime krun: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"
ERRO[0000] running
/usr/bin/newuidmap 241 0 1000 1 1 100000 65536
: newuidmap: open of uid_map failed: Permission deniedError: cannot set up namespace using "/usr/bin/newuidmap": exit status 1
This is the part of the docker file that belong to Podman:
podman config
#RUN --mount=type=cache,target=/var/cache/apt \
echo 'deb http://deb.debian.org/debian/ sid main' > /etc/apt/sources.list.d/podman.list \
&& apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt install -y -qq --no-install-recommends -t sid podman
Set capabilities for newuidmap and newgidmap
RUN setcap cap_setuid+ep /usr/bin/newuidmap &&
setcap cap_setgid+ep /usr/bin/newgidmap
RUN podman system migrate
Configure the registries.conf file
RUN echo 'unqualified-search-registries = ["docker.io", "golem.ilntsur.loc:48444"]' > /etc/containers/registries.conf
Configure the containers.conf file
RUN mkdir -p /home/jenkins/.config/containers &&
echo 'network_backend="netavark"' >> /home/jenkins/.config/containers/containers.conf &&
echo "unqualified-search-registries = ["docker.io", "golem.ilntsur.loc:48444"]" >> /home/jenkins/.config/containers/containers.conf
Set ownership of the config directory
RUN chown -R jenkins:jenkins /home/jenkins/.config
RUN echo "[storage]" > /etc/containers/storage.conf &&
echo "graphroot = "/home/jenkins/.local/share/containers/storage"" >> /etc/containers/storage.conf &&
echo "runroot = "/run/user/1000/containers/storage"" >> /etc/containers/storage.conf &&
echo "driver = "fuse-overlayfs"" >> /etc/containers/storage.conf &&
echo "[storage.options]" >> /etc/containers/storage.conf &&
echo "mount_program = "/usr/bin/fuse-overlayfs"" >> /etc/containers/storage.conf
RUN mkdir -p /home/jenkins/.local/share/containers/storage &&
chown -R jenkins:jenkins /home/jenkins/.local/share/containers/storage
Beta Was this translation helpful? Give feedback.
All reactions