-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: clarify leading and trailing slashes in add/copy source path #5664
docs: clarify leading and trailing slashes in add/copy source path #5664
Conversation
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
relative to the root of the context. | ||
|
||
Specifying a source path with a leading slash or one that navigates outside the | ||
build context, such as `COPY ../something /something`, automatically removes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we document somewhere that for the destination the path may be resolved relative to the WORKDIR that's set, so if it's a relative path (I think) we resolve it relative to the active WORKDIR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like we describe that too well... only indirectly. I guess we could do with a bit more clarity there too. I can do a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, never mind me. We do describe it. I'm just bad at reading documentation.
|
||
Specifying a source path with a leading slash or one that navigates outside the | ||
build context, such as `COPY ../something /something`, automatically removes | ||
any parent directory navigation (`../`). Trailing slashes in the source path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the example you gave, does COPY ../something /something
get treated as COPY something /something
? It's not immediately clear that this is the case...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, COPY ../something /something
and COPY something /something
are equivalent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dvdksn Any chance you could add this clarification to the updated document? Here is what the updated version would look like:
Specifying a source path with a leading slash or one that navigates outside the
build context, such asCOPY ../something /something
, automatically removes
any parent directory navigation (../
), makingCOPY ../something/ /something
equivalent toCOPY something /something
.
Leading and trailing slashes in the source path for
ADD
andCOPY
, whenadding/copying files from the build context, have no effect.