Docker ARG vs ENV

#docker #sysadmin

From https://docs.docker.com/engine/reference/builder/

The ARG instruction defines a variable that users can pass at build-time to the
builder with the docker build command using the --build-arg <varname>=<value>
flag.
The ENV instruction sets the environment variable <key> to the value <value>.
The environment variables set using ENV will persist when a container is run
from the resulting image.

ARG is used to pass build-time instructions whole ENV is used to set environment variables to be used during run-time of the container.