I have a jenkins node/slave where i have docker installed.
I can check that (the jenkins user is able to a spin docker)
[stg-jenkins-slv-1] jenkins:~$ docker run --rm -it node16_16_0_custom_build:latest /bin/bash
node@8508f61f549c:/home/simha/app$
also
uid=1009(jenkins) gid=1011(jenkins) groups=1011(jenkins),0(root),27(sudo),115(docker)
and my jenkins file is
stage('Build reacjts project') {
agent {
docker {
label 'jenkins-slv-1'
image 'node16_16_0_custom_build:latest'}
}
steps {
sh '''
node --version
npm install
npm run build
'''
}
}
I using the lable which corresponds to the jenkins slave/node where the docker is working fine.
but still i am getting
+ docker inspect -f . node16_16_0_custom_build:latest
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/node16_16_0_custom_build:latest/json": dial unix /var/run/docker.sock: connect: permission denied
How to konw the above thing is being access by which user. i am assuming it being accessed by jenkins user on that jenkins slave as lable.
I also tried to restart jenkins server. Because this is not the main jenkins server, its just a node/slave
[stg-jenkins-slv-1] jenkins:~$ sudo service jenkins restart
Failed to restart jenkins.service: Unit jenkins.service not found.
Not able to undestand the issue.
Atlease is there any way to know which user is being used by docker agent to start the docker image, then i can add that user to the docker group