I ran into the following problem: I created a Jenkins docker container and connected the docker socket on the host to the container. Like this:
docker run -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 -p 50000:50000 -d --name jenkins --restart unless-stopped jenkins
Then, when I try to create some jobs on jenkins, I get the usual "denied" message:
Granted permission to refuse when trying to connect to the Docker socket daemon in unix: ///var/run/docker.sock: Get http: //%2Fvar%2Frun%2Fdocker.sock/v1.29/images/json : type unix / var / run / docker.sock: connect: permission denied
But this problem does not occur if I attach to the container and run the command using the root user.
How can i fix this?
I cannot add the jenkins user to the docker group on the host by running sudo gpasswd -a jenkins docker(because the host does not have the jenkins user, only in the container), and I also can not run this command inside the container (because the container does not know about any docker group) . Any tips on how to solve this?
source
share