@@ -1129,20 +1129,26 @@ RUN apt-get update && apt-get install -y ...
1129
1129
ADD has two forms:
1130
1130
1131
1131
```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>" ]
1134
1134
```
1135
1135
1136
1136
The latter form is required for paths containing whitespace.
1137
1137
1138
1138
> ** Note**
1139
1139
>
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,
1141
1141
> and will not work on Windows containers. Since user and group ownership concepts do
1142
1142
> not translate between Linux and Windows, the use of ` /etc/passwd ` and ` /etc/group ` for
1143
1143
> translating user and group names to IDs restricts this feature to only be viable
1144
1144
> for Linux OS-based containers.
1145
1145
1146
+ > ** Note**
1147
+ >
1148
+ > ` --chmod ` is supported since [ Dockerfile 1.3] ( https://docs.docker.com/build/buildkit/dockerfile-frontend/ ) .
1149
+ > Only octal notation is currently supported. Non-octal support is tracked in
1150
+ > [ moby/buildkit #1951 ] ( https://github.com/moby/buildkit/issues/1951 ) .
1151
+
1146
1152
The ` ADD ` instruction copies new files, directories or remote file URLs from ` <src> `
1147
1153
and adds them to the filesystem of the image at the path ` <dest> ` .
1148
1154
@@ -1206,6 +1212,7 @@ ADD --chown=55:mygroup files* /somedir/
1206
1212
ADD --chown=bin files* /somedir/
1207
1213
ADD --chown=1 files* /somedir/
1208
1214
ADD --chown=10:11 files* /somedir/
1215
+ ADD --chown=myuser:mygroup --chmod=655 files* /somedir/
1209
1216
```
1210
1217
1211
1218
If the container root filesystem does not contain either ` /etc/passwd ` or
@@ -1361,15 +1368,15 @@ See [`COPY --link`](#copy---link).
1361
1368
COPY has two forms:
1362
1369
1363
1370
``` dockerfile
1364
- COPY [--chown=<user>:<group>] <src>... <dest>
1365
- COPY [--chown=<user>:<group>] ["<src>" ,... "<dest>" ]
1371
+ COPY [--chown=<user>:<group>] [--chmod=<perms>] <src>... <dest>
1372
+ COPY [--chown=<user>:<group>] [--chmod=<perms>] [ "<src>" ,... "<dest>" ]
1366
1373
```
1367
1374
1368
1375
This latter form is required for paths containing whitespace
1369
1376
1370
1377
> ** Note**
1371
1378
>
1372
- > The ` --chown ` feature is only supported on Dockerfiles used to build Linux containers,
1379
+ > The ` --chown ` and ` --chmod ` features are only supported on Dockerfiles used to build Linux containers,
1373
1380
> and will not work on Windows containers. Since user and group ownership concepts do
1374
1381
> not translate between Linux and Windows, the use of ` /etc/passwd ` and ` /etc/group ` for
1375
1382
> translating user and group names to IDs restricts this feature to only be viable for
@@ -1437,6 +1444,7 @@ COPY --chown=55:mygroup files* /somedir/
1437
1444
COPY --chown=bin files* /somedir/
1438
1445
COPY --chown=1 files* /somedir/
1439
1446
COPY --chown=10:11 files* /somedir/
1447
+ COPY --chown=myuser:mygroup --chmod=644 files* /somedir/
1440
1448
```
1441
1449
1442
1450
If the container root filesystem does not contain either ` /etc/passwd ` or
0 commit comments