Compose: Any way to add dynamic volume in command line ?

Created on 26 Sep 2015  路  2Comments  路  Source: docker/compose

Hi, guys, I wanna add my code directory as a volume to the container, launching the containers by docker-compose up.
I know volumes attribute in docker-compose.yml file, but the code directory differs from each of my colleagues. I checked the doc, but not found -v or similar parameter.
Any help is appreciated.

kinquestion

Most helpful comment

You can use variable interpolation to set the volume path with a variable:

volumes:
   - '$SOURCE_VOLUME:/code'

In the next release (1.5.0) we're adding support for overriding options from a separate docker-compose.override.yaml which would allow each of you to have an override with the path you want.

All 2 comments

You can use variable interpolation to set the volume path with a variable:

volumes:
   - '$SOURCE_VOLUME:/code'

In the next release (1.5.0) we're adding support for overriding options from a separate docker-compose.override.yaml which would allow each of you to have an override with the path you want.

Thanks for reply. I'll try variable interpolation~
Looking forward to the next release.

Was this page helpful?
0 / 5 - 0 ratings