-env VAR
overwrites the samely named var in Docker container if it's not set in host environment
#1780
Labels
-env VAR
overwrites the samely named var in Docker container if it's not set in host environment
#1780
Description
The docs state:
But, when I pass an ENV variable which is not exported in my local environment to a container (
docker run -e VAR
) which has defined such a var by usingENV
Dockerfile instruction, the variable gets overwritten with an empty value inside the container.Steps to reproduce the issue:
I have a Dockerfile with:
Then, I build it like:
Next, I run the container:
Everything works as expected until I pass an ENV var which is not exported into my host environment - the var actually gets set in the container, with an empty value.
Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
I believe this behavior could be because of this line of code in CLI, specifically this call:
opts.ConvertKVStringsToMapWithNil(copts.env.GetAll())
.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
uname -a
:The text was updated successfully, but these errors were encountered: