Skip to content

WORKDIR changes owner to root, regardless of USER #973

@nicks

Description

@nicks

Build the Dockerfile:

FROM ubuntu

RUN useradd alice
RUN mkdir -p /src && chown alice /src && chmod u+rwx /src
USER alice
WORKDIR /src

RUN stat /src && exit 1

Expected:
Stat should print that the owner of /src is "alice"

From docker build .:

Access: (0755/drwxr-xr-x)  Uid: ( 1000/   alice)   Gid: (    0/    root)

Actual:
Stat prints that the owner of /src is "root":

From buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=.

#7 0.216 Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

Tested with buildkit daemon moby/buildkit:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions