Debian Codegraph @

buildkit/frontend/dockerfile/linter/docs/InvalidDefinitionDescription.md

raw
1 ## Output
2
3 ```text
4 Comment for build stage or argument should follow the format: `# <arg/stage name> <description>`. If this is not intended to be a description comment, add an empty line or comment between the instruction and the comment.
5 ```
6
7 ## Description
8
9 The [`--call=outline`](https://docs.docker.com/reference/cli/docker/buildx/build/#call-outline)
10 and [`--call=targets`](https://docs.docker.com/reference/cli/docker/buildx/build/#call-outline)
11 flags for the `docker build` command print descriptions for build targets and arguments.
12 The descriptions are generated from [Dockerfile comments](https://docs.docker.com/reference/cli/docker/buildx/build/#descriptions)
13 that immediately precede the `FROM` or `ARG` instruction
14 and that begin with the name of the build stage or argument.
15 For example:
16
17 ```dockerfile
18 # build-cli builds the CLI binary
19 FROM alpine AS build-cli
20 # VERSION controls the version of the program
21 ARG VERSION=1
22 ```
23
24 In cases where preceding comments are not meant to be descriptions,
25 add an empty line or comment between the instruction and the preceding comment.
26
27 ## Examples
28
29 ❌ Bad: A non-descriptive comment on the line preceding the `FROM` command.
30
31 ```dockerfile
32 # a non-descriptive comment
33 FROM scratch AS base
34
35 # another non-descriptive comment
36 ARG VERSION=1
37 ```
38
39 ✅ Good: An empty line separating non-descriptive comments.
40
41 ```dockerfile
42 # a non-descriptive comment
43
44 FROM scratch AS base
45
46 # another non-descriptive comment
47
48 ARG VERSION=1
49 ```
50
51 ✅ Good: Comments describing `ARG` keys and stages immediately proceeding the command.
52
53 ```dockerfile
54 # base is a stage for compiling source
55 FROM scratch AS base
56 # VERSION This is the version number.
57 ARG VERSION=1
58 ```