docs: clarify a caveat with COPY --link and overwriting directory permissions - #6778
Conversation
| conditions for cache reuse. | ||
|
|
||
| When copying a path into a subdirectory, `--link` will always create the | ||
| parent directories with the default directory creation settings and will always |
There was a problem hiding this comment.
always create the
parent directories with the default directory creation settings
I think it creates the parent directories in whatever settings that were set by the copy command.
There was a problem hiding this comment.
My observed behavior was that parent directories were created with 0755. I'm not sure if that's what's intended but it was the behavior I saw.
There was a problem hiding this comment.
Should be the same as COPY without --link on top of scratch stage.
There was a problem hiding this comment.
This may be related to umask. I tested this on a Mac with Docker Desktop and the VM seems to have a umask of 0022 which may have influenced the results. The code to create these directories seems to be intended to use the --chmod setting but umask may have interfered here.
There was a problem hiding this comment.
I made a note about umask in the COPY --chmod section and how it can affect creating parent directories.
There was a problem hiding this comment.
Umask of the system should never affect the output of buildkit. We are clearing umask in https://github.com/moby/buildkit/blob/master/cmd/buildkitd/main_unix.go#L19
There was a problem hiding this comment.
Just spoke with @tonistiigi about this and there may be some kind of bug. The current behavior definitely seems to apply umask to the created directories but it does appear that it shouldn't be doing that. I'll have to investigate further.
9b10935 to
d87c25f
Compare
|
|
||
| Parent directories will be created with the same mode that is specified by this | ||
| flag. This can be affected by the process umask. This is most common when | ||
| attempting to copy with mode `777` since the common umask of `022` can change |
There was a problem hiding this comment.
This is not true. As I wrote in the previous comment, BuildKit behavior is unaffected by system umask.
d87c25f to
ae129ab
Compare
…ermissions Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
ae129ab to
448f9d3
Compare
Closes #3602.