@@ -1280,11 +1280,11 @@ relative to the build context. For example, if the build context is the current
1280
1280
directory, ` ADD file.txt / ` adds the file at ` ./file.txt ` to the root of the
1281
1281
filesystem in the build container.
1282
1282
1283
- When adding source files from the build context, their paths are interpreted as
1284
- relative to the root of the context. If you specify a relative path leading
1285
- outside of the build context, such as ` ADD ../something /something ` , parent
1286
- directory paths are stripped out automatically. The effective source path in
1287
- this example becomes ` ADD something /something` .
1283
+ Specifying a source path with a leading slash or one that navigates outside the
1284
+ build context, such as ` ADD ../something /something ` , automatically removes any
1285
+ parent directory navigation ( ` ../ ` ). Trailing slashes in the source path are
1286
+ also disregarded, making ` ADD something/ /something ` equivalent to `ADD
1287
+ something /something`.
1288
1288
1289
1289
If the source is a directory, the contents of the directory are copied,
1290
1290
including filesystem metadata. The directory itself isn't copied, only its
@@ -1556,11 +1556,14 @@ For more information about copying from named sources, see the
1556
1556
1557
1557
#### Copying from the build context
1558
1558
1559
- When copying source files from the build context, their paths are interpreted as
1560
- relative to the root of the context. If you specify a relative path leading
1561
- outside of the build context, such as ` COPY ../something /something ` , parent
1562
- directory paths are stripped out automatically. The effective source path in
1563
- this example becomes ` COPY something /something ` .
1559
+ When copying source files from the build context, paths are interpreted as
1560
+ relative to the root of the context.
1561
+
1562
+ Specifying a source path with a leading slash or one that navigates outside the
1563
+ build context, such as ` COPY ../something /something ` , automatically removes
1564
+ any parent directory navigation (` ../ ` ). Trailing slashes in the source path
1565
+ are also disregarded, making ` COPY something/ /something ` equivalent to `COPY
1566
+ something /something`.
1564
1567
1565
1568
If the source is a directory, the contents of the directory are copied,
1566
1569
including filesystem metadata. The directory itself isn't copied, only its
0 commit comments