Output
Description
This check ensures that environment variables and build arguments are correctly declared before being used. While undeclared variables might not cause an immediate build failure, they can lead to unexpected behavior or errors later in the build process.
This check does not evaluate undefined variables for RUN, CMD, and
ENTRYPOINT instructions where you use the shell form.
That's because when you use shell form, variables are resolved by the command
shell.
It also detects common mistakes like typos in variable names. For example, in the following Dockerfile:
The check identifies that $PAHT is undefined and likely a typo for $PATH:
Examples
❌ Bad: $foo is an undefined build argument.
✅ Good: declaring foo as a build argument before attempting to access it.
❌ Bad: $foo is undefined.
✅ Good: the base image defines $PYTHON_VERSION