Compose: Cannot create container for service: Duplicate mount point '/dev/shm'

Created on 22 Apr 2017  路  5Comments  路  Source: docker/compose

There seems to be an issue with tmpfs or /dev/shm when re-creating containers.

I have the following in the docker-compose.yml file:

version: '3.1'
services:
  ...
    tmpfs: /dev/shm:exec,size=1g
    volumes:
      - /dev/shm

When I initially bring this up with docker-compose up it works fine. If I stop it and try to bring it up while also rebuilding the images I get:

> docker-compose up --build
Building ...
...
Successfully built 9a694583ae45
Recreating f2ead6bb4fb2_..._1

ERROR: for ...  Cannot create container for service ...: Duplicate mount point '/dev/shm'
ERROR: Encountered errors while bringing up the project.

> docker-compose --version
docker-compose version 1.11.2, build dfed245
> docker --version
Docker version 17.03.0-ce, build 60ccb22
areup kinbug

Most helpful comment

I've encountered the same issue. For me it looks like it is happening when there is a volume defined in the docker image itself and also in the docker-compose.yml.
I've created a minimal example how to reproduce the error:
https://github.com/usr42/docker-compose-error-duplicate-mount-point

All 5 comments

Looks like the same issue as #4162

I'll take a look, thank you for the report.

Hello, @shin- , this issue seems to be affecting not only tmpfs data volumes, but also regular ones.

I have a Dockerfile that looks like the following and I'm suffering from the exact same symptoms.

version: '3.4'
volumes:
  media_volume:
services:
  svc:
    ...
    volumes:
      - type: volume
        source: media_volume
        target: /media

After bringing up it works fine, then if I try to run docker-compose build then docker-compose up it fails.

ERROR: for ...  Cannot create container for service ...: Duplicate mount point: /media
ERROR: Encountered errors while bringing up the project.

SW Version:

> docker-compose --version
docker-compose version 1.18.0, build unknown

> docker --version
Docker version 17.12.0-ce, build 486a48d270

Would you have any clue of why this is happening? Thanks.

@guiccbr Can you create a new issue and include the commands you're running in order to reproduce the issue? Thanks!

I've encountered the same issue. For me it looks like it is happening when there is a volume defined in the docker image itself and also in the docker-compose.yml.
I've created a minimal example how to reproduce the error:
https://github.com/usr42/docker-compose-error-duplicate-mount-point

i removed the previous container together with its volume when i had the problem -> solved it

Was this page helpful?
0 / 5 - 0 ratings