Working on a Mac. I am trying to run docker in a docker container by mounting docker client and socket like so:
services:
jenkins:
image: ubuntu:latest
container_name: ubuntu
privileged: true
tty: true
volumes:
- ./ubuntu/home:/home
- /usr/local/bin/docker:/usr/bin/docker
- /var/run/docker.sock:/var/run/docker.sock
When I now exec into the container and try to run a docker command, I get this:
➜ test docker exec -it ubuntu /bin/bash
root@c586d6f5fca4:/# which docker
root@c586d6f5fca4:/# docker -h
bash: docker: command not found
root@c586d6f5fca4:/#
Why am I not able to run docker in the container even though the hosts (my Mac) docker client and socket are mounted?
root@c586d6f5fca4:/# ls -la /usr/bin | grep docker
+drwxr-xr-x 2 root root 40 Oct 12 08:49 docker
root@c586d6f5fca4:/var/run# ls -la
total 20
drwxr-xr-x 1 root root 4096 Oct 22 05:54 .
drwxr-xr-x 1 root root 4096 Oct 22 05:54 ..
srwxr-xr-x 1 root root 0 Sep 18 12:38 docker.sock
drwxrwxrwt 2 root root 4096 Oct 3 21:41 lock
drwxr-xr-x 2 root root 4096 Oct 3 21:41 mount
drwxr-xr-x 2 root root 4096 Oct 3 21:44 systemd
The path to docker client on Mac is correct:
➜ ~ which docker
/usr/local/bin/docker
Thanks!