Skip to content

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

Select an icon to see what it is.

Step 4 of 6

-e overrides ENV at run time

docker run -e GREETING=hi puts GREETING=hi in the create request's Env, and that value wins over the image's. The image config is not changed, only this container's environment. Several -e flags or an --env-file can be combined.

$ docker run --rm -e GREETING=hi argdemo

POST /v1.45/containers/create

{
"Image": "argdemo"
"Env": [
"GREETING=hi"
]
}