Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COPY command ignores USER, sets file ownership to root #13020

Closed
rpatrick00 opened this issue May 6, 2015 · 2 comments
Closed

COPY command ignores USER, sets file ownership to root #13020

rpatrick00 opened this issue May 6, 2015 · 2 comments

Comments

@rpatrick00
Copy link

When building an image from a docker file where you have a sequence like so:

USER jim
COPY app/* /u01/app

The copied files will be owned by root rather than by jim.

@GordonTheTurtle
Copy link

Hi!
If you are reporting a new issue, PLEASE make sure that does not have any duplicates already open.

We would like to take this time to remind you of the information we need to debug the problem you are seeing. This is an automated response so if this ticket is not about a bug, do not fret.

If you fail to provide this information within 7 days, we will close this because we cannot debug your issue. We can reopen whenever the information is provided.

Thank you.

Please see:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues

Description of problem:


`docker version`:


`docker info`:


`uname -a`:


Environment details (AWS, VirtualBox, physical, etc.):


How reproducible:


Steps to Reproduce:
1.
2.
3.


Actual Results:


Expected Results:


Additional info:


#ENEEDMOREINFO

@rpatrick00 rpatrick00 changed the title COPY dommand ignores USER, sets file ownership to root COPY command ignores USER, sets file ownership to root May 6, 2015
@duglin
Copy link
Contributor

duglin commented May 6, 2015

I believe this is a dup of #6119 since ADD and COPY are pretty much the same code base

@duglin duglin closed this as completed May 6, 2015
jhrozek added a commit to jhrozek/compliance-operator-1 that referenced this issue Aug 17, 2020
Turns out that podman is not 1:1 compatible with docker, but in this
case it's a good thing, because docker's behaviour is just plain
dangerous - even if a container is running as a non-privileged user by
default (like, the UBI image runs as the user "default"), they'd still
make the files copied with the COPY directive owned by root. Because
honoring the permissions would be a breaking change, docker instead
introduced a --chown parameter to COPY:
    moby/moby#13020
    https://stackoverflow.com/questions/44766665/how-do-i-docker-copy-as-non-root
which podman luckily supports as well.

Without this patch, creating the "_output" directory during the build
would have failed with a Permission denied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants