You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have different targets building different images, and I'd like them all to use the same docker registry address.
I was hoping that ARG can be shared
ARG TST="hello world"
FROM golang:1.13-alpine3.11
test-target:
ARG TST
RUN echo $TST
Proposal
All args declared in the +base target are "global" ARGs. Meaning that they are passed throughout the other targets even if they don't inherit from +base. So the following should print "hello world":
ARG TST="hello world"
FROM golang:1.13-alpine3.11
test-target:
RUN echo $TST
Possible future extension
Could perhaps prevent this behavior if needed with a ARG --local TST="hello world"
Alternatives considered
A possibility might be that ARGs declared in the +base target are global and shared with the rest of the targets, if there is no FROM and they inherit automatically from +base. This would be inconsistent when chaining targets.
Another option could be to always propagate build args too on a FROM. This may be deviating too much from Dockerfile behavior.
Yet another option is to have a special arg ARG --global for such situations.
The text was updated successfully, but these errors were encountered:
Background
@ido-namely reports on Gitter:
Proposal
+base
target are "global" ARGs. Meaning that they are passed throughout the other targets even if they don't inherit from+base
. So the following should print "hello world":Possible future extension
Could perhaps prevent this behavior if needed with a
ARG --local TST="hello world"
Alternatives considered
ARG
s declared in the+base
target are global and shared with the rest of the targets, if there is noFROM
and they inherit automatically from+base
. This would be inconsistent when chaining targets.FROM
. This may be deviating too much fromDockerfile
behavior.ARG --global
for such situations.The text was updated successfully, but these errors were encountered: