I have several services running each database mysql. I use docker-composeto deploy my applications in docker.
I need all these services to be on the same network. For each service, I use different files to create dockers.
My problem: How can I forbid to name the same name (in docker dns) if they have the same name in different build files.
Exemple:
service1.yml
version: '2'
services:
mysql:
image: "mysql"
network:
- anetwork
[...]
service2.yml
version: '2'
services:
mysql:
image: "mysql"
network:
- anetwork
[...]
These two files are in separate folders. After starting all docker layouts. Containers are displayed with docker ps. On the name service1_mysql_1, and another service2_mysql_1. But when I write mysqldns name inside the network anetwork, both answer ...
How can I fix this? Am I using bad methods?
:
-