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

后端 未结 30 1772
孤独总比滥情好
孤独总比滥情好 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 09:53

    If you may get errors like below,

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

    or

    level=error msg="failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: permission denied"
    

    Just try to execute the following commands,

    $ sudo su - jenkins
    $ sudo usermod -a -G docker $USER
    $ sudo chown jenkins:docker /var/run/docker.sock
    

提交回复
热议问题