Last active
November 15, 2021 07:01
-
-
Save chiehpower/269ede1966e589e23c33a52f2cb0809c to your computer and use it in GitHub Desktop.
The question is "When we use the ENV instruction in the dockerfile, can we can keep it in the environment after the container is built?"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvcr.io/nvidia/tensorrt:20.03-py3 | |
ENV TEST_PAR=TEST_dockerfile_env |
for arm device
sudo sed -i'' 's/ports\.ubuntu\.com\/ubuntu-ports/free\.nchc\.org\.tw\/ubuntu-ports/' /etc/apt/sources.list
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discuss about the ENV instruction of Dockerfile
The question is "When we use the ENV instruction in the dockerfile, can we can keep it in the environment after the container is built?"
The answer is YES.
Here is a simple dockerfile about the ENV instruction.
Let's build it.
Check it in
docker images
Run it.
I also did another test which is using
export
directly and exit this container, and then login again.Conclusion
In the past, I was thinking the ENV instruction will only be used in the process of building the image by dockerfile.
The reason is that I misunderstand that ENV is equivalent to
export
because we all know thatexport
is able to be only used once if we don't write theexport
in the.bashrc
file.Hence, I did this simple experiment to prove it.