How they differ
volumes:
- ./db:<path in container> # from the compose file's directory — wherever you run it
# - $PWD/db:<path in container> # from the shell's current directory
Running docker compose -f /opt/panel/docker-compose.yml up -d from somewhere else with $PWD in the path mounts
a wrong folder, and the app starts with an empty database. With ./, the same command mounts /opt/panel/db.
If it doesn’t work
Started the stack from another directory — the app came up with an empty database
- Cause
- The volume says
$PWD/db/: compose substituted the shell’s current directory and mounted someone else’s or an empty folder. - Fix
- Change
$PWD/to./and restart the stack.
How to check
The final paths are visible before you start:
docker compose -f /opt/panel/docker-compose.yml config | grep -A3 volumes