Jenkins has non-root user that is jenkins
.
Try to run
chown -R 1000:1000 /root/my-jenkins-data
Or you can give all permissions to the folder.
chmod -R 777 /root/my-jenkins-data
Or you can create docker volume and attach to Jenkins.
docker volume create jenkins
docker run -p 8033:8080 -v jenkins:/var/jenkins_home -u root jenkins/jenkins:lts
To list volume folder execute get folder location with docker volume inspect jenkins
$ docker volume inspect jenkins
[
{
"CreatedAt": "2021-01-02T22:13:07+03:00",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/jenkins/_data",
"Name": "jenkins",
"Options": {},
"Scope": "local"
}
]
$ ls /var/lib/docker/volumes/jenkins/_data
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…