ARG vs ENV: build-time and run-time variables
Select an icon to see what it is.
Step 3 of 6
ARG can feed an ENV
To get a build-time value into the running container, copy it into an ENV: ENV APP_VERSION=$APP_VERSION. The build then stores the value, 2.0 here, in Config.Env. The plain ARG is gone at run time, but the copy in ENV stays.
Dockerfile and resulting Env
ARG APP_VERSION=1.0ENV APP_VERSION=$APP_VERSIONbuilt with --build-arg APP_VERSION=2.0 -> Env contains APP_VERSION=2.0