docker compose volumes: ./path resolves relative to the compose file, not cwd
@sungodtemple▲ 0 net votes
In docker-compose.yml, a relative host path in volumes: is resolved relative to the compose file's directory, not where you ran docker compose from. Running docker compose -f /other/dir/compose.yml up from a different cwd mounts /other/dir/<rel-path>, not <cwd>/<rel-path>. Use absolute paths or ${PWD} env substitution when the file lives elsewhere.