Volume mounts
jlsalmon opened this issue ยท 7 comments
Edit: apologies if this is the wrong repo to ask this on.
Hello,
First off, massive congratulations for all your work on this so far ๐
Question: is it currently possible to mount volumes from the host into macOS containers via -v
? I didnโt see it explicitly mentioned, so maybe it just works or maybe itโs a future thing.
Thanks in advance!
Good question. They were supposed to Just Work, but now my testing shows that they don't!
Investigating what went wrong...
Fixed in rund 0.0.2 + dockerd 0.0.2. If you already installed those packages from homebrew-formula, you can brew update && brew upgrade && sudo brew services restart dockerd
to get update.
Awesome, thanks @slonopotamus, Iโll try it out!
Hmm possibly I don't have something set up correctly? (macOS 14 (Sonoma), dockerd 0.0.2, rund 0.0.2, containerd 0.0.1)
Working without volume mount:
docker run --rm -it ghcr.io/macoscontainers/macos-jail/ventura:latest ls -al /etc
WARNING: The requested image's platform (unknown) does not match the detected host platform (darwin/arm64/v8) and no specific platform was requested
total 16
drwxr-xr-x 5 root staff 160 Sep 27 05:44 .
drwxr-xr-x 10 root staff 320 Sep 27 05:44 ..
-rw-r--r-- 1 root staff 230 Jul 28 15:10 hosts
-rw-r--r-- 1 root staff 357 Jul 28 15:10 resolv.conf
drwxr-xr-x 6 root wheel 192 Sep 27 05:44 ssl
Fails with volume mount:
docker run --rm -it -v /tmp:/etc/tmp ghcr.io/macoscontainers/macos-jail/ventura:latest ls -al /etc
WARNING: The requested image's platform (unknown) does not match the detected host platform (darwin/arm64/v8) and no specific platform was requested
docker: Error response from daemon: failed to create task for container: failed to create shim task: failed to mount rootfs component: bindfs [[/tmp /private/d/vfs/edd4d567227cc39e4cfeb4071218d0c97a82caa94d85489909d1e07b7103c7b1/etc/tmp]] failed: "Failed to resolve mount point `/private/d/vfs/edd4d567227cc39e4cfeb4071218d0c97a82caa94d85489909d1e07b7103c7b1/etc/tmp': No such file or directory\n": exit status 1: unknown.
Oh, it looks like the leaf directory needs to already exist. I found an empty directory in the container and it works:
docker run --rm -it -v /tmp:/etc/ssl/certs ghcr.io/macoscontainers/macos-jail/ventura:latest ls -al /etc/ssl/certs
WARNING: The requested image's platform (unknown) does not match the detected host platform (darwin/arm64/v8) and no specific platform was requested
total 24
drwxrwxrwt@ 4 root wheel 128 Sep 27 04:31 .
drwxr-xr-x 6 root wheel 192 Sep 27 05:55 ..
drwx------ 3 gitlab-bot wheel 96 Sep 27 04:31 com.apple.launchd.z626qD94iW
drwxr-xr-x 2 root wheel 64 Sep 27 04:31 powerlog
Uh. Let's reopen. Not sure yet which part of this whole mess is supposed to create directory :D
Fixed in rund-0.0.3, now full directory hierarchy for bind mount target directory is created inside container. Just brew update && brew upgrade
.