USER and COPY Docker command (basic)


Just want to get some confirmation.
According to (USER Docker file command documentation) and to (COPY Docker file command documentation), if, in a Dockerfile, I chain the 2 commands like below:

USER foo
COPY from to

This means that all files copied to “to” will belong to root user and not foo.

Is my understanding, right ? Could you confirm, please ?
Is this stuff subject to change in next Docker releases ?

Best Regards.


Any answer to my questions ?

Best regards.


Indeed, ADD doesn’t honour USER and the files copied will be owned by root.
You can see the discussion of the implementation of the feature here:
And the actual PR here:

Last status is: “and I agree with you we should add that” :slight_smile: