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

Volume using variable with fallback defined in .env file stopped working in compose v2 #9498

Closed
maryo opened this issue May 24, 2022 · 2 comments
Labels

Comments

@maryo
Copy link

maryo commented May 24, 2022

Volume using variable with fallback defined in .env file stopped working in compose v2.

.env

VOLUME_SSH_AUTH_SOCK=${SSH_AUTH_SOCK:-/run/host-services/ssh-auth.sock}

docker-compose.yml

# ...
volumes:
# ...
  - ${VOLUME_SSH_AUTH_SOCK}:/ssh-agent

produces
error decoding 'Volumes[12]': invalid spec: :-/run/host-services/ssh-auth.sock}:/ssh-agent: empty section between colons

Works when using compose v1.
Works when using v2 only when the fallback of the VOLUME_SSH_AUTH_SOCKis not present or when the fallback is present in the compose file and not in the .env file.

ie.
docker-compose.yml

# ...
volumes:
# ...
  - ${SSH_AUTH_SOCK:-/run/host-services/ssh-auth.sock}:/ssh-agent

works in both v1 and v2

@maryo maryo changed the title Volume defined using variable with fallback in .env stopped working in compose v2 Volume using variable with fallback defined in .env file stopped working in compose v2 May 24, 2022
@stale
Copy link

stale bot commented Jan 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 7, 2023
@maryo
Copy link
Author

maryo commented Mar 10, 2023

Tried after some time and now it works. Thanks to the one who fixed it :-)

@maryo maryo closed this as completed Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant