I want to use the MySQL docker container for several projects running on the same server.
Using docker-compose v3 files, I just have the same mysql container configuration in each of the projects, and they have the same container_name :
version: "3" services: app1: image: foo links: - mysql mysql: image: mysql/mysql:5.7 container_name: shared_mysql
The second application has a similar docker-compose.yml , but with app2 instead of app1 .
When starting docker-compose up --no-recreate for app2 I get an error message:
Creating shared_mysql ... error ERROR: for shared_mysql Cannot create container for service mysql: Conflict. The container name "/shared_mysql" is already in use by container "deadbeef". You have to remove (or rename) that container to be able to reuse that name.
What can I do to split the MySQL container between multiple docker projects?
source share