Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment Variables in volumes trigger named volume warning #1867

Closed
karlkfi opened this issue Aug 13, 2015 · 2 comments · Fixed by #1870
Closed

Environment Variables in volumes trigger named volume warning #1867

karlkfi opened this issue Aug 13, 2015 · 2 comments · Fixed by #1870

Comments

@karlkfi
Copy link

karlkfi commented Aug 13, 2015

Warning added in #1833 is triggered by volumes starting with environment variables (e.g. ${VOLUME_DIR}:/var/stuff).

How would we know whether the env-var was a name or a path?

Is there a way to wait to test for .~/ until after env-vars are evaluated?

@aanand
Copy link

aanand commented Aug 14, 2015

This is partly a bug, and partly a side-effect of how variable substitution has been implemented in the past for volume paths.

First of all, Compose is substituting variables before checking the host path. That's not the issue. However, two things are currently wrong:

  1. The error message prints out the input string, rather than the evaluated string. That's an easy one to fix - I'll do that now.
  2. The method we use to substitute variables - os.path.expandvars - performs no expansion if a variable is unset, meaning the final value will still be ${VOLUME_PATH}:/var/stuff. This is obviously (to me) a bug. The good news is that it's already fixed in master, as a result of the new universal variable substitution code merged in Interpolate environment variables #1765.

@karlkfi
Copy link
Author

karlkfi commented Aug 20, 2015

Thanks @aanand!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants