Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume mounts #14

Closed
jlsalmon opened this issue Sep 24, 2023 · 7 comments
Closed

Volume mounts #14

jlsalmon opened this issue Sep 24, 2023 · 7 comments

Comments

@jlsalmon
Copy link

jlsalmon commented Sep 24, 2023

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!

@slonopotamus
Copy link
Collaborator

Good question. They were supposed to Just Work, but now my testing shows that they don't!

Investigating what went wrong...

@slonopotamus slonopotamus transferred this issue from darwin-containers/homebrew-formula Sep 25, 2023
slonopotamus added a commit to darwin-containers/moby that referenced this issue Sep 25, 2023
@slonopotamus
Copy link
Collaborator

slonopotamus commented Sep 25, 2023

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.

@jlsalmon
Copy link
Author

Awesome, thanks @slonopotamus, I’ll try it out!

@jlsalmon
Copy link
Author

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.

@jlsalmon
Copy link
Author

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

@slonopotamus
Copy link
Collaborator

slonopotamus commented Sep 27, 2023

Uh. Let's reopen. Not sure yet which part of this whole mess is supposed to create directory :D

@slonopotamus
Copy link
Collaborator

slonopotamus commented Sep 27, 2023

Fixed in rund-0.0.3, now full directory hierarchy for bind mount target directory is created inside container. Just brew update && brew upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants