Make Jenkins run docker without sudo

后端 未结 4 863
小鲜肉
小鲜肉 2020-12-11 03:34

I would like to run Docker shell commands on Jenkins like:

docker ps

Is it possible to do it with out using any plugi

4条回答
  •  感动是毒
    2020-12-11 04:20

    (Taken from this answer: https://askubuntu.com/a/477554)

    If you run on Ubuntu and Jenkins runs directly on the host machine (i.e. not inside a Docker container):

    Add the docker group if it doesn't already exist:

    sudo groupadd docker
    

    Add the user "jenkins" to the docker group:

    sudo gpasswd -a jenkins docker
    

    Restart the Docker daemon:

    sudo service docker restart
    

    Either do a newgrp docker or log out/in to activate the changes to groups.

提交回复
热议问题