[feature request/propsal] add option `--keep-ownership` for ADD and COPY commands
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
Description
I would love to keep the ownership on ADD and COPY commands, that are copy my files from local and also from images.
Steps to reproduce the issue:
- create Dockerfile with ADD and/or COPY from you local storage (owned by 1123:1123)
- build it
- check the Ownership
Describe the results you received:
files are owned by root:root
Describe the results you expected:
I would expect to have a option ADD --keep-ownership /file /file or COPY --keep-ownership /file /file that keeps the ownership of my files, like 1123:1123 if my user has the UID and GID or the files if I run it as root.
** Additonal references: **
https://github.com/containers/buildah/pull/3767
https://github.com/containers/buildah/pull/4001
https://github.com/openshift/imagebuilder/pull/227
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
Start by tracing BuildKit's Dockerfile ADD and COPY command handling, then compare the linked Buildah and imagebuilder pull requests. Verify how ownership is assigned for local files and image sources. Done means an explicit --keep-ownership option preserves source UID/GID ownership for both commands.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dockerfile, go
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100