Description: On macOS, the docker-compose.yml file fails to start because it uses an absolute host path for the transfer volume. Since /data is not a default directory on macOS and is restricted by the root filesystem, Docker Desktop throws a "mounts denied" error.
Current Configuration in docker-compose.yml:
YAML
service:
# ...
volumes:
- secrets:/etc/secrets
- /data/transfer:/data/transfer
Steps to Reproduce:
-
Clone
getodk/centralon a macOS machine. -
Run the standard startup command (e.g.,
docker-compose up). -
Observe the error:
Error response from daemon: mounts denied: The path /data/transfer is not shared from the host and is not known to Docker.
=> => naming to docker.io/library/central-nginx:latest 0.0s
=> => unpacking to docker.io/library/central-nginx:latest 0.2s
=> [nginx] resolving provenance for metadata file 0.0s
[+] build 6/6
✔ Image central-nginx Built 34.3s
✔ Image central-postgres Built 34.3s
✔ Image central-secrets Built 34.3s
✔ Image central-enketo Built 34.3s
✔ Image central-postgres14 Built 34.3s
✔ Image central-service Built 34.3s
vivekgupta@VGMBPm2 central % docker compose up -d
[+] up 0/1
⠋ Volume central_secrets Creating 0.0s
[+] up 11/11ound orphan containers ([central-client-1]) for this project. If you removed or renamed this service in your compose file, you can run this comman ✔ Volume central_secrets Created 0.0s
✔ Container central-secrets-1 Recreated 0.2s
✔ Container central-pyxform-1 Recreated 1.1s
✔ Container central-postgres-1 Recreated 0.6s
Error response from daemon: mounts denied:
The path /data/transfer is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/go/mac-file-sharing/ for more info.
Expected Behavior:
One clear cut solution has been pointed out in error message. However, I feel a simple way would also be to ensure the path should be relative to the project directory (e.g., ./data/transfer) to ensure portability across different Operating Systems without requiring users to manually create root-level directories to docker-compose.yml
volumes:
- secrets:/etc/secrets
- ./data/transfer:/data/transfer
The ./data/transfer directory should also be added to .gitignore
# Local data storage
/data/
Warm Regards
Vivek