compose: Ending slash in container path volume handling is buggy

Description of the issue

Ending slash in container path volume handling is buggy when merging configs and duplicate mountpoings paths since 1.24.1.

Context information (for bug reports)

Output of docker-compose version

>= 1.24.1

Consider those two configs:

version: "3.7"
services:
  test:
    image: ubuntu
    volumes:
    - prod:/prod
volumes:
  prod:
version: "3.7"
services:
  test:
    volumes:
    - ./dev:/prod/

take care to /prod/

This will fail with Output of docker-compose config

ERROR: Duplicate mount points: [prod:/prod:rw, /home/kiorky/for-tests/fail3/dev:/prod:rw]

But if you remove the ending slash: / in the second config:

version: "3.7"
services:
  test:
    volumes:
    - ./dev:/prod

It will return the expected result

services:
  test:
    image: ubuntu
    volumes:
    - /home/kiorky/for-tests/fail3/dev:/prod:rw
version: '3.7'
volumes:
  prod: {}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15

Most upvoted comments

not stale

not stale