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 --link parameters. expose environment variables originating docker source container. these include variables from:

  • the env commands in source container's dockerfile
  • the -e, --env , --env-file options on docker run command when source container started

http://docs.docker.com/userguide/dockerlinks/

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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -