Add --user flag to Dockerfile ADD and COPY#27303
Add --user flag to Dockerfile ADD and COPY#27303ardnaxelarak wants to merge 1 commit intomoby:masterfrom
Conversation
|
golint is complaining |
|
Given that the major use case (perhaps only one?) is to make the files owned by the current user, would having an option to just specify current user be nicer? |
|
perhaps but I'd like to hear from the people who asked for this to know if the use case is "current user" vs "some non-root user". |
|
@ardnaxelarak I tested this with user namespace and it didn't seem to work properly. I had no new files after |
2a26e05 to
2818c36
Compare
fixed |
I've reproduced this locally and will look into it. |
|
ping @estesp you also mentioned a suggestion to keep permissions as-is from the host; perhaps you could join this discussion to see if there's overlap / conflicts between that option, and the one that's implemented here? |
2818c36 to
677e710
Compare
This seems to be working (for me at least) now. EDIT: never mind, it's broken again. |
|
thanks @thaJeztah Yes, this came up recently in a discussion around why If no one can find a good reason [I'm not "old" enough in the codebase to have been around when that code was put there], I think a first step is to stop that blind |
677e710 to
cd256ee
Compare
|
The user namespace issue should be fixed now, still trying to figure out how to write a test for it. |
Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
cd256ee to
5c67289
Compare
|
@ardnaxelarak there is no need in test while patch in design-review. |
|
I want this MR. Currently I am doing this With this MR, I will be able to simply do this: The VOLUME instruction will be included directly in the image |
|
Closing in favor of #28499 please add comments on the idea and code in there. |
|
This is now implemented through #34263, which is included in Docker 17.09 and up |
the "--chown" COPY argument requires Docker 17.09 and up: moby/moby#27303 (comment)
- What I did
Add a
--userflag to Dockerfile ADD and COPY instructions, proposed by #13600- How I did it
Added flag to
addanddisptachCopyofbuilder/dockerfile/dispatchers.go, and passed the relevant information through to the daemon which looks up the user/group using a new function on the container object.- How to verify it
Create a Dockerfile that uses the
--userflag on an ADD or COPY instruction, and check that the file is listed as having the appropriate owner- Description for the changelog
add
--userflag to Dockerfile ADD and COPY instructions- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Kara Alexandra kalexandra@us.ibm.com