Showing how Dockerfile ARG ENV works and how docker build / run can override them at Buildtime and Runtime using alpine image
ARG/ENV - Cheatsheet
Dockerfile
ARG key // required @ CLI build
ARG key=val // default value
ENV key=val // default value
ENV key=${key} // def. val. fr. ARG
Buildtime override ARG
build --build-arg key=val
Runtime override ENV
run -e "key=val"
run -e key // host environment
run --env-file env.config // file
https://vsupalov.com/docker-arg-env-variable-guide
$ docker build [OPTIONS] PATH | URL | -
- URL
e.g.docker build https://github.com/vincenthome/sample-docker-arg-env.git#main
(main is the branch name) - --build-arg
$ docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
- -e, --env-file