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

后端 未结 30 1774
孤独总比滥情好
孤独总比滥情好 2020-11-27 09:00

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.



        
30条回答
  •  清酒与你
    2020-11-27 10:01

    The user jenkins needs to be added to the group docker:

    sudo usermod -a -G docker jenkins
    

    Then restart Jenkins.

    Edit

    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 alice
    

    or whatever your username is.

    You can check it at the end doing grep docker /etc/group and see something like this:

    docker:x:998:alice
    

    in one of the lines.

    Then change your users group ID to docker:

    newgrp docker
    

提交回复
热议问题