Permission denied error invoking Docker on Mac host from inside Docker Ubuntu container as non-root user

前端 未结 3 1736

I\'m trying to invoke docker on my OSX host running Docker for Mac 17.06.0-ce-mac17 from inside a running jenkins docker container (jenkins:latest), per the procedure described

3条回答
  •  情歌与酒
    2021-02-15 17:38

    Follow this: https://forums.docker.com/t/mounting-using-var-run-docker-sock-in-a-container-not-running-as-root/34390

    Basically, all you need to do is to change /var/run/docker.sock permissions inside your container and run the docker with sudo.

    I've created a Dockerfile that can be used to help:

    FROM jenkinsci/blueocean:latest
    
    USER root
    # change docker sock permissions after moutn
    RUN if [ -e /var/run/docker.sock ]; then chown jenkins:jenkins /var/run/docker.sock; fi
    

提交回复
热议问题