My host is on alpine Linux and I'm running a jenkins agent on docker. I need the jenkins agent to be able to run a script when it does a build that changes the ownership of a few directories. Every time I run the script as the jenkins user from the container I get "Operation not permitted". I'm able to run the script fine from the host and fine as root on the container. my dodas config (on host) is:
permit persist :wheel permit nopass Local_Admin cmd /srv/scripts/setperm.sh permit nopass :wheel cmd /srv/scripts/setperm.sh I get this when I do id for my host account:
uid=1000(Local_Admin) gid=1000(Local_Admin) groups=0(root),10(wheel),18(audio),27(video),28(netdev),1000(Local_Admin),1000(Local_Admin) on the container as the jenkins user i get
uid=1000(jenkins) gid=1000(jenkins) groups=10(wheel),1000(jenkins) Any ideas?
EDIT I don't know if it matters but here is the script and permissions
#!/bin/sh chgrp -R jenkins /home/jenkins/docker-volumes chmod g+rwx -R /home/jenkins/docker-volumes echo "$USER" id and permissions
dockingbay2:~$ cd /srv/scripts dockingbay2:/srv/scripts$ ls -l total 4 -rwsr-xr-x 1 root root 199 May 14 08:29 setperm.sh dockingbay2:/srv/scripts$
docker exec -u root "$CONTAINER_NAME" chgrp -R jenkins /home/jenkins/docker-volumes docker exec -u root "$CONTAINER_NAME" chmod g+rwx -R /home/jenkins/docker-volumesyou could usedocker execto run the code, but i figured it was easer to just call the two commands I needed.