Build checks

BuildKit has built-in support for analyzing your build configuration based on a set of pre-defined rules for enforcing Dockerfile and building best practices. Adhering to these rules helps avoid errors and ensures good readability of your Dockerfile.

Checks run as a build invocation, but instead of producing a build output, it performs a series of checks to validate that your build doesn't violate any of the rules. To run a check, use the --check flag:

$ docker build --check .
NameDescription
StageNameCasingStage names should be lowercase
FromAsCasingThe 'as' keyword should match the case of the 'from' keyword
NoEmptyContinuationEmpty continuation lines will become errors in a future release
ConsistentInstructionCasingInstructions should be in consistent casing (all lower or all upper)
FileConsistentCommandCasingAll commands within the Dockerfile should use the same casing (either upper or lower)
DuplicateStageNameStage names should be unique
ReservedStageNameReserved words should not be used as stage names
JSONArgsRecommendedJSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals
MaintainerDeprecatedThe MAINTAINER instruction is deprecated, use a label instead to define an image author
UndefinedArgInFromFROM command must use declared ARGs
WorkdirRelativePathRelative workdir without an absolute workdir declared within the build can have unexpected results if the base image changes
UndefinedVarVariables should be defined before their use
MultipleInstructionsDisallowedMultiple instructions of the same type should not be used in the same stage
LegacyKeyValueFormatLegacy key/value format with whitespace separator should not be used