InvalidDefinitionDescription
目录
注意
此检查是实验性的,默认情况下未启用。要启用它,请参阅 实验性检查。
输出
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.
描述
命令的 --call=outline
和 --call=targets
标志打印构建目标和参数的描述。
描述是从 or 指令前面的 Dockerfile 注释生成的
,并且以生成阶段或参数的名称开头。
例如:docker build
FROM
ARG
# build-cli builds the CLI binary
FROM alpine AS build-cli
# VERSION controls the version of the program
ARG VERSION=1
在前面的注释不是描述的情况下, 在指令和前面的注释之间添加空行或注释。
例子
❌ 错误:命令前一行的非描述性注释。FROM
# a non-descriptive comment
FROM scratch AS base
# another non-descriptive comment
ARG VERSION=1
✅ Good:分隔非描述性注释的空行。
# a non-descriptive comment
FROM scratch AS base
# another non-descriptive comment
ARG VERSION=1
✅ Good:描述立即执行命令的键和阶段的注释。ARG
# base is a stage for compiling source
FROM scratch AS base
# VERSION This is the version number.
ARG VERSION=1