How do I access the environment variables of a source container from another container which is linking to it with the --link argument?
The docker manual states:
Environment Variables
Docker creates several environment variables when you link containers. Docker automatically creates environment variables in the target container based on the
--linkparameters. It will also expose all environment variables originating from Docker from the source container. These include variables from:
- the
ENVcommands in the source container's Dockerfile- the
-e,--envand--env-fileoptions on thedocker runcommand when the source container is started
But I can't access an environment variable which I set with
ENV MY_VARIABLE = "example"
in the linking container with
#!/bin/sh
echo $MY_VARIABLE
it will contain no value.