Description
#1492 added support for e.g. --chmod=744
during a COPY
command. Here is the original issue for supporting octal notation moby/moby#34819. However, in many situations this is insufficient.
For example, g=u
is a way to chmod so that the group gets the same permissions as the user like so: chmod -R g=u dir
. This would equal:
COPY --chmod=g=u --from=builder /server/ /server/
This is for example important in OpenShift.
@tobia also added some very valid argumentation for this: moby/moby#34819 (comment):
The usefulness of alpha syntax usually comes from the capital
X
permission, which means "executable only if the file was previously executable or if it is a directory."This is because a recursive COPY with
--chmod=644
would make all directories non-executable, meaning non-traversable; while a--chmod=755
would make all files executable. Both are inappropriate therefore unuseable 99% of the time.A recursive COPY with
--chmod=u=rwX,go=rX
(capital Xes) would set directories to 755 and files to 644, unless a given file already had the executable bit in the source filesystem, in which case it would get 755.
It would be very nice if this support could be added!