Docker Community Forums

Share and learn in the Docker community.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post

Hi…I am running my jenkins job on windows os in which I am building war file on slavenode which is a ubuntu 18.07 server. My Docker is installed on my slavenode. My Docker file is in workspace. But while building the image I am facing below error:

[slaveAnsibleDocker] $ docker build -t swagats/helloimage --pull=true /home/ubuntu/workspace/slaveAnsibleDocker Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&pull=1&rm=1&session=utpwhi2ue7xox69p9mibabkb7&shmsize=0&t=swagats%2Fhelloimage&target=&ulimits=null&version=1: dial unix /var/run/docker.sock: connect: permission denied Build step ‘Docker Build and Publish’ marked build as failure

Finished: FAILURE

I have already added my slavenode user to Docker group & inside slavenode workspace (ubuntu server) , I am able to create image without using sudo.
But still I am facing the error in Jenkins. Please help me.