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

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

    I have Jenkins running in Docker and connected Jenkins is using Docker socket from host machine Ubuntu 16.04 via volume to /var/run/docker.sock.

    For me solution was:

    1) Inside Docker container of Jenkins (docker exec -it jenkins bash on host machine)

    usermod -a -G docker jenkins
    chmod 664 /var/run/docker.sock
    service jenkins restart (or systemctl restart jenkins.service)
    su jenkins
    

    2) On host machine:

    sudo service docker restart
    

    664 means - read and write(but not execute) for owner and users from group.

提交回复
热议问题