COPY --from does not keep permission or owner on the <src> main directory
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
Let's say I've set some owner (uid:gid) like this in a builder image:
FROM ubuntu as builder
RUN chown -R 1000:0 /server/
If I sh into that builder image, I can see that the server/ dir has 1000:0 set. Also subdirectories also has 1000:0 set.
But when I do:
COPY --from=builder /server/ /server/
and then sh into that image, I can see that server/ has 0:0 set. But all subdirectories still has 1000:0 set.
In other words, the actual <src> directory copied does not keep the owner of the main directory copied.
The same problem occurs is using chmod to change permissions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the builder and final-stage Dockerfiles shown in the issue, checking ownership and permissions on both the copied source directory and its subdirectories. Trace the BuildKit handling of COPY --from metadata and add a regression test; done means the source directory's owner and permissions are preserved like those of its contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dockerfile, go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100