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

Variable substitution in YAML keys #5567

Closed
mvasin opened this issue Jan 12, 2018 · 3 comments
Closed

Variable substitution in YAML keys #5567

mvasin opened this issue Jan 12, 2018 · 3 comments

Comments

@mvasin
Copy link

mvasin commented Jan 12, 2018

Variable substitution works for YAML's array elements and hash values, but does not work for hash keys (see the last line):

version: "3"

services:
  ubuntu:
    image: ubuntu
    volumes:
      - $VOL

volumes:
  ${VOL}:

=>

$ VOL=some_vol docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
volumes value '${VOL}' does not match any of the regexes: u'^[a-zA-Z0-9._-]+$'

I'm running docker-compose version 1.17.1, build 6d101fb.

@shin-
Copy link

shin- commented Jan 12, 2018

That's by design - you can use the search function to see prior discussion of the same issue.

You can use version: '3.4' and the name key for parametrized volume names.

@mvasin
Copy link
Author

mvasin commented Jan 12, 2018

I've found #3858, sorry for duplicating.

And thanks for the hint with name in version: "3.4"! It worked perfectly.

@samskiter
Copy link

Paging @shin- I think I need this feature or a fix for external EFS volumes (see docker-archive/compose-cli#2164 (comment))

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

No branches or pull requests

3 participants