Skip to content

Commit 7950fa4

Browse files
authored
Merge pull request moby#5126 from dvdksn/docs-improve-LegacyKeyValueFormat
docs: add a multi-line ENV example
2 parents 0b1a789 + 465c933 commit 7950fa4

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

frontend/dockerfile/docs/rules/legacy-key-value-format.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,21 @@ FROM alpine
3636
ARG foo=bar
3737
```
3838

39+
❌ Bad: multi-line variable declaration with a space separator.
40+
41+
```dockerfile
42+
ENV DEPS \
43+
curl \
44+
git \
45+
make
46+
```
47+
48+
✅ Good: use an equals sign and wrap the value in quotes.
49+
50+
```dockerfile
51+
ENV DEPS="\
52+
curl \
53+
git \
54+
make"
55+
```
56+

frontend/dockerfile/linter/docs/LegacyKeyValueFormat.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,21 @@ ARG foo bar
2828
FROM alpine
2929
ARG foo=bar
3030
```
31+
32+
❌ Bad: multi-line variable declaration with a space separator.
33+
34+
```dockerfile
35+
ENV DEPS \
36+
curl \
37+
git \
38+
make
39+
```
40+
41+
✅ Good: use an equals sign and wrap the value in quotes.
42+
43+
```dockerfile
44+
ENV DEPS="\
45+
curl \
46+
git \
47+
make"
48+
```

0 commit comments

Comments
 (0)