Skip to content
← Back to activity

Immutable solution version

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

Version 1

Complete solution

If using jenkins The user jenkins needs to be added to the group docker : sudo usermod -a -G docker jenkins Then restart Jenkins.

If using jenkins The user jenkins needs to be added to the group docker : sudo usermod -a -G docker jenkins Then restart Jenkins. Otherwise If you arrive to this question of stack overflow because you receive this message from docker, but you don't use jenkins, most probably the error is the same: your unprivileged user does not belong to the docker group. You can do: sudo usermod -a -G docker $USER You can check it was successful by doing grep docker /etc/group and see something like this: docker:x:998:[user] in one of the lines. Then change your users group ID to docker (to avoid having to log out and log in again): newgrp docker

Context: I am new to docker. I just tried to use docker in my local machine(Ubuntu 16.04) with Jenkins. I configured a new job with below pipeline script. node { stage('Build') { docker.image('maven:3.3.3').inside { sh 'mvn --version' } } } But it fails with this error: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Evidence

Source: I am new to docker. I just tried to use docker in my local machine(Ubuntu 16.04) with Jenkins. I configured a new job with below pipeline script. node { stage('Build') { docker.image('maven:3.3.3').inside { sh 'mvn --version' } } } But it fails with this error: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Verified resolution: If using jenkins The user jenkins needs to be added to the group docker : sudo usermod -a -G docker jenkins Then restart Jenkins. Otherwise If you arrive to this question of stack overflow because you receive this message from docker, but you don't use jenkins, most probably the error is the same: your unprivileged user does not belong to the docker group. You can do: sudo usermod -a -G docker $USER You can check it was successful by doing grep docker /etc/group and see something like this: docker:x:998:[user] in one of the lines. Then change your users group ID to docker (to avoid having to log out and log in again): newgrp docker

Source URL: https://stackoverflow.com/questions/47854463/docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socke

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_5vTaXqVsBM_ipODSoi4_bg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock <span>— Vectle</span></a>

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