Skip to content

Commit 7cba279

Browse files
darkvertexcrazy-max
authored andcommitted
Update builder.md to document newly supported --chmod features in both ADD and COPY statements.
Co-Authored-by: Alan Fregtman <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]> Signed-off-by: CrazyMax <[email protected]>
1 parent 13ea5ae commit 7cba279

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

frontend/dockerfile/docs/reference.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,15 +1129,15 @@ RUN apt-get update && apt-get install -y ...
11291129
ADD has two forms:
11301130
11311131
```dockerfile
1132-
ADD [--chown=<user>:<group>] [--checksum=<checksum>] <src>... <dest>
1133-
ADD [--chown=<user>:<group>] ["<src>",... "<dest>"]
1132+
ADD [--chown=<user>:<group>] [--chmod=<perms>] [--checksum=<checksum>] <src>... <dest>
1133+
ADD [--chown=<user>:<group>] [--chmod=<perms>] ["<src>",... "<dest>"]
11341134
```
11351135
11361136
The latter form is required for paths containing whitespace.
11371137

11381138
> **Note**
11391139
>
1140-
> The `--chown` feature is only supported on Dockerfiles used to build Linux containers,
1140+
> The `--chown` and `--chmod` features are only supported on Dockerfiles used to build Linux containers,
11411141
> and will not work on Windows containers. Since user and group ownership concepts do
11421142
> not translate between Linux and Windows, the use of `/etc/passwd` and `/etc/group` for
11431143
> translating user and group names to IDs restricts this feature to only be viable
@@ -1206,6 +1206,7 @@ ADD --chown=55:mygroup files* /somedir/
12061206
ADD --chown=bin files* /somedir/
12071207
ADD --chown=1 files* /somedir/
12081208
ADD --chown=10:11 files* /somedir/
1209+
ADD --chown=myuser:mygroup --chmod=655 files* /somedir/
12091210
```
12101211

12111212
If the container root filesystem does not contain either `/etc/passwd` or
@@ -1361,15 +1362,15 @@ See [`COPY --link`](#copy---link).
13611362
COPY has two forms:
13621363

13631364
```dockerfile
1364-
COPY [--chown=<user>:<group>] <src>... <dest>
1365-
COPY [--chown=<user>:<group>] ["<src>",... "<dest>"]
1365+
COPY [--chown=<user>:<group>] [--chmod=<perms>] <src>... <dest>
1366+
COPY [--chown=<user>:<group>] [--chmod=<perms>] ["<src>",... "<dest>"]
13661367
```
13671368

13681369
This latter form is required for paths containing whitespace
13691370

13701371
> **Note**
13711372
>
1372-
> The `--chown` feature is only supported on Dockerfiles used to build Linux containers,
1373+
> The `--chown` and `--chmod` features are only supported on Dockerfiles used to build Linux containers,
13731374
> and will not work on Windows containers. Since user and group ownership concepts do
13741375
> not translate between Linux and Windows, the use of `/etc/passwd` and `/etc/group` for
13751376
> translating user and group names to IDs restricts this feature to only be viable for
@@ -1437,6 +1438,7 @@ COPY --chown=55:mygroup files* /somedir/
14371438
COPY --chown=bin files* /somedir/
14381439
COPY --chown=1 files* /somedir/
14391440
COPY --chown=10:11 files* /somedir/
1441+
COPY --chown=myuser:mygroup --chmod=644 files* /somedir/
14401442
```
14411443

14421444
If the container root filesystem does not contain either `/etc/passwd` or

0 commit comments

Comments
 (0)