Open tarilabs opened 1 year ago
Hi š
Thanks for opening a detailed issue, appreciate it. Looping in @chrmarti for his expertise.
We update the UID and GID when using Linux as the host automatically. If there was a reliable and quick way to determine if this is needed on macOS, we could do it there too.
Thanks for the quick feedback!
So is this "hardcode" in place because there is no reliable way to determine when needed on MacOSX?
Sorry if a banal question, just curious as I'm learning on DevContainer more š
When using Docker Desktop, you get automatic ownership on bind mounts and the UID/GID updating isn't needed. I added the updateRemoteUserUIDOnMacOS
flag to experiment with colima.
If this is not the right place for this report, my apologies and kindly let me know where this shall better be placed š
My issue is: I am wondering if this is the expected way to use DevContainer on a Mac when not using Docker for Mac, or I hope these notes could be helpful if someone lands here :) --like I landed myself when I first needed to address "my" issue.
Exec summary
I have the need to develop using a particular version of CPython and ABI/platform for architecture
x86_64
but I'm on Apple Silicon M2 (arm64
) (SEO: aarch64 ARM). I found DevContainer could be helpful but I experienced some issues as detailed in this article. I am NOT using Docker for Mac, I'm specifically usingcolima version 0.5.6
as it was the first suggesion on this page, but the concepts can be helpful in general for mount permission issues.i.e.: Take the DevContainter
image
, use it as theFROM
in a Dockerfile, and apply snippet at the end similar to:š In the end it seems to me any DevContainer mount permission issues I encounterd, boils down to the
mountType
(virtiofs, 9p, sshfs) used by Colima depending if using qemu or vz Rosetta.Details
mountType: sshfs - works out of the box
Used:
colima start
.Because by default is
mountType: sshfs
, writing file seems to be working just fine.mountType: 9p - does NOT work ootb
Used:
colima start --mount-type 9p
. Because ismountType: 9p
, writing file does not work and seems to be affected by what described here.To fix the permission issue, using a variation from this: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_change-the-uidgid-of-an-existing-container-user
That is using image as FROM in a Dockerfile and a snippet as:
I have added
-o
togroupmod
as the gid might be already present from the inherited Docker images.mountType: virtiofs - does NOT work ootb
Used:
colima start --vz-rosetta --vm-type vz --arch x86_64 --cpu 4 --memory 8
. Because ismountType: virtiofs
, writing file (againg) does not work and seems to be affected by what described here.So again to fix the permission issue, applying the variation of the Dockerfile snippet.
This is what I need. The DevContainer is connecting into a
x86_64
. I can use the CPython and the ABI/Platform I need. I can write to file in the workspace/repository.What did not work
Tried with using in
devcontainer.json
:but did not help.
You can follow along notes of the tests also in the git history of this repo: https://github.com/tarilabs/demo20231027-dcmac/commits/main
Other resources I found helpful