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

前端 未结 3 1756

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:34

    Another approach that worked for me - set the uid argument to the uid that owns /var/run/docker.sock (501 in my case). Not sure of the syntax for Dockerfile, but for docker-compose.yml, it's like this:

    version: 3
    services:
      jenkins:
        build:
          context: ./JENKINS
          dockerfile: Dockerfile
          args:
            uid: 501
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
        ...
    

    Note this is based on using a Dockerfile to build the jenkins image, so many details left out. The key bit here is the uid: 501 under args.

提交回复
热议问题