I am following the following doc to deploy to Kubernetes from Jenkins. I have installed jenkins in my own VM. But getting following error when build is run
+ docker build -t myregistry.azurecr.io/my-svc:latest7 ./my-svc
cannot create user data directory: /var/lib/jenkins/snap/docker/321: Read-only file system
Build step 'Execute shell' marked build as failure
Finished: FAILURE
However all the directories have jenkins use as the owner, I am not sure why it is getting into permission issues.
poc@poc-ubuntu:~$ ls -ltr /var/lib/
drwxr-xr-x 18 jenkins jenkins 4096 Feb 18 16:45 jenkins
I believe you must be extending the Jenkins image. /var/lib/jenkins is a mount point. You can't create a directory at build time from dockerfile. If you need to create a folder in that directory then try to create using init script at container runtime
Was running into the same exact issue. Here's the workaround (from user Gargoyle (g-rgoyle) here) that worked for me:
service jenkins stop
mv /var/lib/jenkins /home/jenkins
usermod -m -d /home/jenkins jenkins
nano /etc/default/jenkins
then go down to variable "JENKINS_HOME
" and set value to "/home/$NAME
"service jenkins start