Skip to content

VirtioFS directory mapping wrong uid/gid on Darwin (docker rootful template) #4053

@paolomainardi

Description

@paolomainardi

Description

Hi everyone!

I'm experiencing an issue with incorrect UID/GID mapping for an existing directory. When this directory is mapped inside a container, I expect it to be mounted with the uid:gid as files, which is the usual behavior on Linux with Docker Desktop.

Here’s what is happening when comparing Lima and Docker Desktop:

❯ ls -altr
total 0
-rw-r--r--@   1 paolomainardi  staff     0 Sep 18 17:07 test
drwxr-xr-x@   3 paolomainardi  staff    96 Sep 18 17:07 .
drwxr-xr-x@ 105 paolomainardi  staff  3360 Sep 18 17:13 ..

❯ docker context use lima-sf-docker-dev
lima-sf-docker-dev
Current context is now "lima-sf-docker-dev"

❯ docker run -u 501 --rm -v $PWD:/test alpine:latest ash -c "ls -altr / | grep test"
drwxr-xr-x    3 root     root            96 Sep 18 15:07 test

❯ docker context use desktop-linux
desktop-linux
Current context is now "desktop-linux"

❯ docker run -u 501 --rm -v $PWD:/test alpine:latest ash -c "ls -altr / | grep test"
drwxr-xr-x    3 501      root            96 Sep 18 15:07 test

This isn’t a major issue, but it has disrupted several of my scripts, including a command that triggers the error fatal: detected dubious ownership in repository when running git rev-parse --show-toplevel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions