Skip to content

Commit a958d9d

Browse files
committed
docs: use json args in multiple instructions example
Signed-off-by: David Karlsson <[email protected]>
1 parent aaaf86e commit a958d9d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

frontend/dockerfile/docs/rules/multiple-instructions-disallowed.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ Dockerfile, only the last occurrence is used. An image can only ever have one
2323

2424
```dockerfile
2525
FROM alpine
26-
CMD echo "Hello, Norway!"
27-
CMD echo "Hello, Sweden!"
26+
ENTRYPOINT ["echo", "Hello, Norway!"]
27+
ENTRYPOINT ["echo", "Hello, Sweden!"]
2828
# Only "Hello, Sweden!" will be printed
2929
```
3030

31-
✅ Good: only one `CMD` instruction.
31+
✅ Good: only one `ENTRYPOINT` instruction.
3232

3333
```dockerfile
3434
FROM alpine
35-
CMD echo "Hello, Norway!"; echo "Hello, Sweden!"
35+
ENTRYPOINT ["echo", "Hello, Norway!\nHello, Sweden!"]
3636
```
3737

3838
You can have both a regular, top-level `CMD`
@@ -44,7 +44,7 @@ and a separate `CMD` for a `HEALTHCHECK` instruction.
4444
FROM python:alpine
4545
RUN apk add curl
4646
HEALTHCHECK --interval=1s --timeout=3s \
47-
CMD curl -f http://localhost:8080 || exit 1
48-
CMD python -m http.server 8080
47+
CMD ["curl", "-f", "http://localhost:8080"]
48+
CMD ["python", "-m", "http.server", "8080"]
4949
```
5050

frontend/dockerfile/linter/docs/MultipleInstructionsDisallowed.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ Dockerfile, only the last occurrence is used. An image can only ever have one
1616

1717
```dockerfile
1818
FROM alpine
19-
CMD echo "Hello, Norway!"
20-
CMD echo "Hello, Sweden!"
19+
ENTRYPOINT ["echo", "Hello, Norway!"]
20+
ENTRYPOINT ["echo", "Hello, Sweden!"]
2121
# Only "Hello, Sweden!" will be printed
2222
```
2323

24-
✅ Good: only one `CMD` instruction.
24+
✅ Good: only one `ENTRYPOINT` instruction.
2525

2626
```dockerfile
2727
FROM alpine
28-
CMD echo "Hello, Norway!"; echo "Hello, Sweden!"
28+
ENTRYPOINT ["echo", "Hello, Norway!\nHello, Sweden!"]
2929
```
3030

3131
You can have both a regular, top-level `CMD`
@@ -37,6 +37,6 @@ and a separate `CMD` for a `HEALTHCHECK` instruction.
3737
FROM python:alpine
3838
RUN apk add curl
3939
HEALTHCHECK --interval=1s --timeout=3s \
40-
CMD curl -f http://localhost:8080 || exit 1
41-
CMD python -m http.server 8080
40+
CMD ["curl", "-f", "http://localhost:8080"]
41+
CMD ["python", "-m", "http.server", "8080"]
4242
```

0 commit comments

Comments
 (0)