1

After running:

  brew cask install docker

UNIX socket file is not part of docker group in my mac laptop(docker host)

$ ls -l /var/run/docker.sock
lrwxr-xr-x  1 root  daemon  70 12 Jan 08:19 /var/run/docker.sock -> /Users/user1/Library/Containers/com.docker.docker/Data/docker.sock

because docker group is not created

 $ cat /etc/group | grep docker
 $ uname -a
Darwin user1 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec  1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64

 $
 $ cat /etc/group | grep daemon
 daemon:*:1:root

On ubuntu docker group name gets created, after installation of docker

Running jenkins docker container(as DIND), but cannot perform usermod -aG docker jenkins within Dockerfile.

Goal is to run docker client within jenkins container that can talk to docker daemon running on docker host, through UNIX socket file(/var/run/docker.sock).


Why installation of docker on mac does not create docker group?

How to resolve this problem?

overexchange
  • 15,768
  • 30
  • 152
  • 347
  • Have you checked that the _numeric_ group IDs match? Are you running Docker-in-Docker, or trying to reuse the host Docker socket? What specific commands are you running and what specific errors are you getting? – David Maze Jan 12 '20 at 18:13

1 Answers1

2

Docker for Mac is just special like that. You can solve it few ways:

From least recommended to most recommended order:

  1. Modify the permission of /var/run/docker.sock so that other groups can access the socket.
  2. Give sudo access to the jenkins user
  3. Use socat to expose the daemon on tcp socket instead.

From https://www.benjaminpack.com/blog/docker-jenkins-mac/

The socat process wraps /var/run/docker.sock on the host by way of a mounted volume and exposes it in a bi-directional fashion as a TCP server to Jenkins. All without giving Jenkins more permissions than it needs.

Shashank V
  • 10,007
  • 2
  • 25
  • 41