I have repeatedly received the following error on multiple projects after stopping the service using docker-compose:
root@db:/srv/rnet_ttrss# docker-compose up -d
Recreating 45066480dc82_rnet_db_ttrss ... error
ERROR: for 45066480dc82_rnet_db_ttrss Cannot create container for service ttrss_mysql: Duplicate mount point: /var/lib/mysql
ERROR: for ttrss_mysql Cannot create container for service ttrss_mysql: Duplicate mount point: /var/lib/mysql
ERROR: Encountered errors while bringing up the project.
All my projects have compose files similar to this:
version: "3.3"
volumes:
ttrss_mysql_data:
networks:
ttrssnet:
driver: bridge
driver_opts:
com.docker.network.bridge.name: ttrssnet
secrets:
dbhost:
file: ./secrets/dbhost
dbname:
file: ./secrets/dbname
dbpass:
file: ./secrets/dbpass
dbport:
file: ./secrets/dbport
dbtype:
file: ./secrets/dbtype
dbuser:
file: ./secrets/dbuser
dbrootpass:
file: ./secrets/dbrootpass
selfurlpath:
file: ./secrets/selfurlpath
services:
ttrss:
image: registry.gitlab.com/jerrac/rnet_ttrss/app_ttrss:latest
container_name: rnet_app_ttrss
ports:
- 127.0.0.1:3050:80
networks:
- ttrssnet
depends_on:
- ttrss_mysql
restart: always
secrets:
- dbhost
- dbname
- dbpass
- dbport
- dbtype
- dbuser
- selfurlpath
ttrss_mysql:
image: mysql:5
container_name: rnet_db_ttrss
volumes:
- type: volume
source: ttrss_mysql_data
target: /var/lib/mysql
- type: bind
source: ./datamount
target: /srv
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/dbrootpass
MYSQL_DATABASE: rnet_ttrss
MYSQL_USER: rnet_ttrss
MYSQL_PASSWORD_FILE: /run/secrets/dbpass
networks:
- ttrssnet
restart: always
secrets:
- dbname
- dbpass
- dbuser
- dbrootpass
While working in development, I can just delete the old volume and then recreate it. But that loses all my data. I cannot do that in production. Today I lost access to my personal TinyTinyRSS instance because of this.
I have spent hours searching the web using different search keywords, and I have not found a solid answer. I also posted on the Docker Discourse, but I have not received a reply.
System info:
root@db:/srv/rnet_ttrss# docker-compose --version
docker-compose version 1.20.1, build 5d8c71b
root@db:/srv/rnet_ttrss# docker --version
Docker version 18.03.0-ce, build 0520e24
root@db:/srv/rnet_ttrss# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
root@db:/srv/rnet_ttrss#
Any help would be appreciated. Let me know if there's a better place to ask this kind of question.
Thanks!
In my case it deleting old containers created by docker-compose for the project worked. As I probably changed the volume name but docker compose was using the old container and during mounting the volume was throwing this error. After deleting the containers docker compose was forced to recreate containers with the new volume name.
Are you still encountering this issue or did either of the comments made here and on the forums fix the issue?
If not then a smaller reproducible would be helpful
I ran into this as well.
docker-compose down -v
worked around the issue.
Since this issue seems related to an environmental issue and not an error in the image itself I'm going to close as there isn't anything we could foreseeably change in the image.
If the two suggestions about refreshing volumes doesn't work you could try asking the Docker Community Forums, the Docker Community Slack, or Stack Overflow
I eventually restored from a backup, or something, and used a bind mount. It's been long enough that I can't recall enough about the issue to recreate it.
Refreshing the volumes would have deleted my data, which is what I was trying to avoid. So...
I ran into this as well.
docker-compose down -vworked around the issue.
This works for me. Thank you very much. ;)
Most helpful comment
I ran into this as well.
worked around the issue.