Jenkins wrong volume permissions

后端 未结 8 1045
迷失自我
迷失自我 2020-12-16 14:39

I have a virtual machine hosting Oracle Linux where I\'ve installed Docker and created containers using a docker-compose file. I placed the jenkins volume under a shared fol

相关标签:
8条回答
  • 2020-12-16 15:12

    This error solve using following commnad.

    goto your jenkins data mount path : /media

    Run following command :

    cd /media
    sudo chown -R ubuntu:ubuntu sf_devops-workspaces
    

    restart jenkins docker container

    docker-compose restart jenkins
    
    0 讨论(0)
  • 2020-12-16 15:15

    Had a similar issue on MacOS, I had installed Jenkins using helm over a Minikube/Kubenetes after many intents I fixed it adding runAsUser: 0 (as root) in the values.yaml I use to deploy jenkins.

    master:
      usePodSecurityContext: true
      runAsUser: 0
      fsGroup: 0
    

    Just be careful because that means that you will run all your commands as root.

    0 讨论(0)
  • 2020-12-16 15:18

    The easy fix it to use the -u parameter. Keep in mind this will run as a root user (uid=0)

    docker run -u 0 -d -p 8080:8080 -p 50000:50000 -v /data/jenkins:/var/jenkins_home jenkins/jenkins:lts
    
    0 讨论(0)
  • 2020-12-16 15:20

    I had same issue it got resolved after disabling the SELINUX. It's not recommended to disable the SELINUX so install custom semodule and enable it. It works. Only changing the permissions won't work on CentOS 7.

    0 讨论(0)
  • 2020-12-16 15:24

    first of all you can verify your current user using echo $USER command and after that you can mention who is the user in the Dockerfile like bellow (in my case user is root) screenshot

    0 讨论(0)
  • 2020-12-16 15:31

    You may be under SELinux. Running the container as privileged solved the issue for me:

    sudo docker run --privileged -p 8080:8080 -p 50000:50000 -v /data/jenkins:/var/jenkins_home jenkins/jenkins:lts

    From https://docs.docker.com/engine/reference/commandline/run/#full-container-capabilities---privileged:

    The --privileged flag gives all capabilities to the container, and it also lifts all the limitations enforced by the device cgroup controller. In other words, the container can then do almost everything that the host can do. This flag exists to allow special use-cases, like running Docker within Docker.

    0 讨论(0)
提交回复
热议问题