0

According to the fig YML reference, I should be able to declare an environment variable with only a key to resolve this to the corresponding variable on the host. That doesn't work for me in boot2docker.

Here's my fig.yml:

test:
    image: ubuntu
    command: env
    environment:
        TESTVAR:

I'm running TESTVAR=foo fig up and I'm getting the following output:

test_1 | TESTVAR=

I suspect this is because I'm using the fig container with the alias from fig #598 in boot2docker, which probably doesn't pass the environment variables through properly. Is there any workaround for this?

Henrik Heimbuerger
  • 9,924
  • 6
  • 56
  • 69

1 Answers1

1

The value should be getting picked up from the environment where fig is run using https://docs.python.org/2/library/os.html#os.environ

Looking at that alias, it does look like the fig command actually gets run in a container, so I think you're right.

You could modify the alias to pass in other environment variables using

-e TESTVAR=$(TESTVAR)
dnephin
  • 25,944
  • 9
  • 55
  • 45
  • Duh, of course, I could have seen that myself… Even easier, I can do just `-e TESTVAR` (without giving it a value) and docker will take the value from the host. – Henrik Heimbuerger Jan 22 '15 at 09:50