abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
17.73k stars 364 forks source link

Can't read from /var/folders/ from docker #1021

Open chlab opened 2 months ago

chlab commented 2 months ago

Description

I'm having trouble reading from a folder under /var/ (on the host) from docker and am suspecting that it might be a colima thing. If not, please let me know.

I am running a local backstage instance and noticed that it can't read the temp files backstage generates to /var/folders/wt/*/T/backstage-*. Unfortunately I don't see where I could change the path where these temp files are stored. So I tried cding into the directory in question and running a little test:

➜  backstage-N4zMz6 ls -l
total 856
drwxrwxr-x@ 14 chle  staff     448 Apr 29 08:05 docs
-rw-r--r--@  1 chle  staff    1281 Apr 24 10:37 mkdocs.yml
-rw-r--r--@  1 chle  staff  425339 Apr 24 10:37 package-lock.json
-rw-r--r--@  1 chle  staff     549 Apr 24 10:37 package.json
-rw-r--r--@  1 chle  staff    2701 Apr 24 10:37 readme.md
drwxr-xr-x@  2 chle  staff      64 Apr 29 08:10 site

(output as expected)

but if I run an ls -l in a docker container, I only see site

➜  backstage-N4zMz6 docker run --rm -w /content -v "/private/var/folders/wt/3z9vk6f57v9d6dqzlkp_xxm00000gn/T/backstage-N4zMz6:/content" ubuntu ls -l
total 4
drwxr-xr-x 2 root root 4096 Apr 29 06:10 site

Why can't I see the other files in the docker container? Can someone point me in the right direction here?

From reading around a bit I made sure that the folder is the filesharingDirectories array in ~/Library/Group\ Containers/group.com.docker/settings.json, but that didn't change anything.

  "filesharingDirectories": [
    "/Users",
    "/Volumes",
    "/private",
    "/tmp",
    "/var/folders",
    "private/var/folders"
  ],

Thanks ❤️

Version

colima version HEAD-9b0809d git commit: 9b0809d0ed9ad3ff1e57c405f27324e6298ca04f

runtime: docker arch: aarch64 client: v25.0.4 server: v24.0.9 limactl version 0.21.0 qemu-img version 8.2.1 Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

Operating System

Output of colima status

INFO[0000] colima is running using macOS Virtualization.Framework INFO[0000] arch: aarch64 INFO[0000] runtime: docker INFO[0000] mountType: virtiofs INFO[0000] socket: unix:///Users/chle/.colima/default/docker.sock

Reproduction Steps

As described, don't know if others can reproduce this

Expected behaviour

I see all the files and folders in the ls -l ran in the docker container

Additional context

No response