Skip to content

hadolint/DL3044

Do not refer to an undefined variable.

Superseded by buildkit/UndefinedVar, which provides the same check with typo detection.

Description

Ensures that environment variables and build arguments are declared before being used. Undeclared variables can lead to unexpected behavior or build errors.

Examples

Problematic code

FROM alpine
COPY $foo .

Correct code

FROM alpine
ARG foo
COPY $foo .

Reference