When configuring Docker bind mounts (or any persistence paths), set the container mount target to exactly where the application writes at runtime—especially when code uses relative paths like Path.cwd() / "...". Don’t pick mount targets by convention; derive them from the actual path resolution logic.
How to apply:
save_report_to_disk()), and note the base path (often Path.cwd()).WORKDIR) so Path.cwd() resolves to a specific absolute path in the container.Example:
# writes to a path relative to the container working directory
out_path = Path.cwd() / "reports"
out_path.mkdir(parents=True, exist_ok=True)
# bind the host reports dir to the container cwd-resolved reports dir
services:
app:
working_dir: /home/appuser/app
volumes:
- ./reports:/home/appuser/app/reports
This ensures user-facing generated artifacts persist to the intended host location, rather than accidentally redirecting only unrelated logs or internal files.
Enter the URL of a public GitHub repository