I am trying to recursively copy some files and directories into a Docker image. The source directory contains files and a sub-directory with some files in it.
src/
├─ subdir/
│ ├─ sub_file_1
│ ├─ sub_file_2
├─ file_1
├─ file_2
...
├─ file_n
I am running the following command in Dockerfile:
COPY --chown=user:user --chmod=600 src/ /dst/
The permissions are correctly applied for all top level files (file_1 to file_n) and the sub directory itself, but not for the files in subdir (e.g. sub_file_1).
Entering the container and running ls, the output is:
user@container:/$ ls -la /dst/subdir
ls: cannot access '/dst/subdir/sub_file_1': Permission denied
ls: cannot access '/dst/subdir/sub_file_2': Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
-????????? ? ? ? ? ? sub_file_1
-????????? ? ? ? ? ? sub_file_2
Is there a way to recursively apply --chmod and --chown options of the COPY command?