You can use ENV for environment variables to use during the build and in containers. With this Dockerfile: FROM ubuntu ARG BUILD_TIME=abc ENV RUN_TIME=123 RUN touch /env.txt RUN printenv > /env.txt You can override the build arg as you have done with docker build -t temp --build-arg BUILD_TIME=def .. Then you get what you expect: More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.