Skip to content

Instantly share code, notes, and snippets.

@DerekChia
Last active December 26, 2021 18:32
Show Gist options
  • Save DerekChia/3720bf92d31a2cf307eef2b0059c09a8 to your computer and use it in GitHub Desktop.
Save DerekChia/3720bf92d31a2cf307eef2b0059c09a8 to your computer and use it in GitHub Desktop.
$ docker build --build-arg SOME_VAR=new-value --no-cache -t demo .
### REMOVED ###
Step 2/5 : ENV SOME_VAR=env-value
---> Running in 10d7cb325994
Removing intermediate container 10d7cb325994
---> dcab47c67952
Step 3/5 : ARG SOME_VAR=arg-value
---> Running in 265c48974673
Removing intermediate container 265c48974673
---> 3fab670db0bf
Step 4/5 : RUN echo "Build-time: SOME_VAR is set to ${SOME_VAR:-}"
---> Running in 0339a0690972
Build-time: SOME_VAR is set to env-value
Removing intermediate container 0339a0690972
---> aa61afbb01cd
### REMOVED ###
$ docker run --rm demo
Run-time: SOME_VAR is set to env-value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment