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

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

    On the server where Jenkins is running, I used

    sudo setfacl -m user:tomcat:rw /var/run/docker.sock
    

    And then run each docker container with

    -v /var/run/docker.sock:/var/run/docker.sock
    

    Using setfacl seems a better option, and no "-u user" is needed. The containers then run as the same user that is running Jenkins. But I would appreciate any feedback from the security experts.

提交回复
热议问题