docker
build
ai_generated
true
WARNING: One or more build-args were not consumed
ID: docker/build-arg-not-set
93%Fix Rate
94%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 24 | active | — | — | — |
| 27 | active | — | — | — |
Root Cause
Build arguments passed via --build-arg are not declared in the Dockerfile with ARG.
genericWorkarounds
-
96% success Add ARG <name> in the Dockerfile before the RUN command that uses it
ARG must appear before the first usage in the Dockerfile
-
90% success For multi-stage builds, add ARG in each stage that needs it
ARG is scoped to the build stage; must be redeclared after each FROM
Dead Ends
Common approaches that don't work:
-
Ignoring the warning
50% fail
The build arg isn't being used; the feature it should configure isn't applied
-
Setting build args as ENV instead
60% fail
ENV is baked into the image at runtime; different semantics from build-time ARG
Error Chain
Frequently confused with: