Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jet10000/1e0ced20bbc12622de8b36be2dca0aa2 to your computer and use it in GitHub Desktop.
Save jet10000/1e0ced20bbc12622de8b36be2dca0aa2 to your computer and use it in GitHub Desktop.
Using docker compose to mount current working directory dynamically into the container
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment