TARGETARCH/TARGETPLATFORM scope and behaviour #1975
Unanswered
droopy4096
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It seems that scope for "automatic"
TARGETARCH
andTARGETPLATFORM
are no well defined. Consider example:as per docs - it works as expected
however
does not - producing "empty" output
Yet, when I use it within
FROM ...
statement it seems to workto take it further I've tried
and it works just fine with default cli options. So I ended up using:
docker buildx build --platform=linux/amd64 -f Dockerfile -t my-my .
with previous Dockerfile and that did result in expected:
in other words confirming that automatic vars like
$TARGETPLATFORM
have "odd" scoping:FROM ...
statementsARG
.❓ Question:
Moving forward should we always use
ARG TARGETARCH
and such to declare intent to use that automatic variable or is this an intended behaviour andFROM ...
will receive automatic variable without declaration yet anywhere else there needs to be explicit declaration?Beta Was this translation helpful? Give feedback.
All reactions