Skip to content

Return a clear error when bind-mounting relative path #346

@psviderski

Description

@psviderski

When attempting to deploy the following compose.yaml:

services:
  atomdns:
    #    image: registry.science.ru.nl/cncz/sys/image/atomdns:latest
    image: debian:bookworm-slim
    entrypoint:
      - /bin/sh
      - "-c"
      - "ls -l /conf/Conffile"
    x-ports:
      - ctrl.uncld.science.ru.nl:443/https

    deploy:
      replicas: 1

    volumes:
      - ./atomdns:/conf:ro
      - atomdns_data:/var/lib/atomdns

volumes:
  atomdns_data:

it will attempt to mount /Users/richard/projects/uc/atom/atomdns on the remote machine but this is the path resolved from ./atomdns on the local machine.

$ docker container inspect d32e134ec731
...
 "Mounts": [
            {
                "Type": "bind",
                "Source": "/Users/richard/projects/uc/atom/atomdns",
                "Destination": "/conf",
                "Mode": "",
                "RW": false,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "atomdns_data",
                "Source": "/var/lib/docker/volumes/atomdns_data/_data",
                "Destination": "/var/lib/atomdns",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
        ],
...

We should fail with a clear error message that mounting a relative path won't work as a user might expect. And we can hint that using configs is likely what the user needs.

See original issue: #330

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions