My question is, how to do the same with Docker for Mac? I’ve tried all variations I can think of of the Linux technique above. I can share the .sock between the host and the CI container, but not the Docker executable itself.
apt-get install docker.io, or whatever your distribution-specific equivalent is, inside your container; don’t try to bind-mount the executable. This should work:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:16.04 bash
apt-get install docker.io
docker version
(I’ve seen a couple of posts very recently on this exact topic that lead me to wonder whether Alpine binaries are actually compatible with other distributions; in this case because the Moby VM is Alpine and your other container probably isn’t, the other one where the container they were trying to run was Alpine. I know it’s a different libc.)