Accessing Environment Variables in a linked Docker -
how access environment variables of source container container linking --link argument? docker manual states:
environment variables
docker creates several environment variables when link containers. docker automatically creates environment variables in target container based on
--linkparameters. expose environment variables originating docker source container. these include variables from:
- the
envcommands in source container's dockerfile- the
-e,--env,--env-fileoptions ondocker runcommand when source container started
but can't access environment variable set with
env my_variable = "example" in linking container with
#!/bin/sh echo $my_variable it contain no value.
environment variables source container prefixed alias set --link <source container>:<alias> in target container:
$<alias>_env_<env variable> the environment variable accessible follows if <alias> e.g. set source:
#!/bin/sh echo $source_env_my_variable
Comments
Post a Comment