Bug: absolute path /data/transfer in docker-compose.yml causes 'mounts denied' on macOS

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:

  1. Clone getodk/central on a macOS machine.

  2. Run the standard startup command (e.g., docker-compose up).

  3. 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

@spwoodcock must be so annoyed to see that this is still open even though he proposed a solution a while ago (ODK Central: make data directory configurable - #5 by spwoodcock) :grimacing: We hear you!

In the upcoming release, @Nonsequitur is reworking backups and as part of that we are aiming to address this.

Not at all - its simple enough to work around!

Happy to see its in the pipeline though :grin:

1 Like