Created
August 31, 2017 22:27
-
-
Save shaiguitar/627d52ebc0c03af488477b5d636a8909 to your computer and use it in GitHub Desktop.
Using docker compose to mount current working directory dynamically into the container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mount volume PWD on host to /app in container. | |
shai@lappy ~/tmp/example-working-docker-compose-environment-vars [master *] ± % cat docker-compose.yml | |
version: "3" | |
services: | |
some_server: | |
... | |
volumes: | |
- $PWD:/app | |
# so using this from which/wherever you run this from, PWD should be updated and reflected within the container it runs in. | |
# /app within container should be reflected to be wherever you run this command from. | |
docker-compose -f ~/tmp/example-working-docker-compose-environment-vars/docker-compose.yml |
thanks
Does not work when running compose from Windows
@jhanley-com run docker compose config
to validate
@jhanley-com Hope this can help: https://stackoverflow.com/a/66268597, seems that PWD
does not exist in Windows.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great. Thank you.