Docker compose using $(PWD) in bind mount doesn't work
I have a docker compose project in the solution (.dcproj).
In its docker compose.yaml file we can bind mount a directory from the host into the container.
i'd like to bind mount a location relative to the compose file itself. I am used to using this syntax which works in other scenarios:
volumes:
- ${PWD}/workflows:/app/workflows
However rider complains that there is no value for environment variable PWD and so it uses an empty string.
When editing the run config for compose project, there is no available environment variable to use for the working directory. There is also seemingly no option too suppy arbitrary additional arguments to docker compose up.
What is the solution here?
Please sign in to leave a comment.
Also I don't want to have to tell developers to create a PWD environment variable with a hard coded value pointing at the source code repository location on their machine - that is a bad solution.
I found a solution..
a relative path can be used in the volume mount - the quotes are important.
volumes:
- './workflows:/app/workflows' # relative to this compose yaml file.