Open misterikkit opened 2 years ago
Note that the Dockerfile reference clearly states:
All new files and directories are created with a UID and GID of 0, unless the optional
--chown
flag specifies a given username, groupname, or UID/GID combination to request specific ownership of the content added.
Just ran into this problem myself. Issue has been open for 2+ years. :(
In case anyone else ends up here looking for a more immediate solution:
You can use the --chown
flag to emulate the correct result:
COPY --chown=0:0 file file
But I think you will need to run Kaniko with superuser permissions to make this work this way.
Actual behavior Running kaniko in my local docker daemon, files copied with
COPY
still have my UID in the built container. This breaks reproducibility when different users build the same image because the file's UID is included in the layer hash.Expected behavior Files copied with
COPY
and no--chown
arg should be defaulted to UID 0 as per the Dockerfile documentationTo Reproduce
Additional Information
Workaround Explicitly add
--chown
to everyCOPY
/ADD
in each Dockerfile.Triage Notes for the Maintainers
--cache
flag