Open jjmaestro opened 1 month ago
Huh, I just tried the following and it works!
$ docker run \
--rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
docker version
Client:
Version: 27.1.1
API version: 1.46
Go version: go1.21.12
Git commit: 6312585
Built: Tue Jul 23 19:55:52 2024
OS/Arch: linux/arm64
Context: default
Server: Docker Desktop 4.33.0 (160616)
Engine:
Version: 27.1.1
API version: 1.46 (minimum version 1.24)
Go version: go1.21.12
Git commit: cc13f95
Built: Tue Jul 23 19:57:14 2024
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.19
GitCommit: 2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
runc:
Version: 1.7.19
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Then, I checked the Docker on Mac VM and sure enough, that's the docker socket inside the Linux VM.
Yes, I think this is the expected behavior; bind mounts happen from the host where the daemon runs (on desktop, that's inside the VM); the socket on the host is a proxy for that socket, and also handles various conversions (host paths to vm paths etc), so to access the daemon socket, using the standard (/var/run/docker.sock) path should be the way to go
@thaJeztah Sure, but then, how come I can bind mount e.g. a folder in my home directory? or any other path in Mac, for that matter? It's because /
is mounted in /host_mnt/
inside the VM, correct? If so, that's why I would expect mounting the "outside socket" to work. Is there something else that's failing here?
@thaJeztah is there a way to "run docker context list
in the Docker VM"? For example, if I want to script getting the path to the socket in the VM, I can do this in e.g. Lima:
DOCKER_CONTEXT_VM="$(limactl shell "$VM_NAME" docker context show)"
DOCKER_HOST_VM="$(limactl shell "$VM_NAME" \
docker context inspect --format "{{.Endpoints.docker.Host}}" "$DOCKER_CONTEXT_VM"
)"
Can I do something like that in the Docker VM? All I've found so far is "Getting a Shell in the Docker Desktop Mac VM" but I can't run docker context
(or any docker
command) in that shell.
Thanks!
Description
I was trying to run DooD in MacOS running Docker Desktop and running a countainer where I mount the docker socket but I can't get it to work.
Reproduce
Run DooD with the
docker
image:Just in case, I've also tried with other custom images where I change permissions to the socket (
chmod 777
), change ownership (chown root:docker
), making sure there's noDOCKER_HOST
environment variable set, and that the context is the default one, and running--privileged
. Nothing works.Expected behavior
I shouldn't get a
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
error, it should be able to connect to the outside docker.docker version
docker info
Diagnostics ID
7B54016F-97E6-428E-92C4-F7D32BCF51F6/20240810001351
Additional Info