Skip to content

ARG vs ENV: build-time and run-time variables

Select an icon to see what it is.

Step 2 of 6

ENV is stored in the image

ENV GREETING=hello adds a line to the image config's Env list. Every container started from this image gets that variable, and the later build instructions can use it too. The value lives in the image, so anyone who has the image can read it.

Image config

{
"Config": {
"Env": [
"PATH=<default path>"
"GREETING=hello"
]
}
}