today I started to setup a new NGINX container I want to use as a reverse proxy for the containers on my RasperryPi.
In order to test NGINX features, I created a limitated set of containers.
I created 3 docker-compose files, one for NGINX and the other two are for two different services of Transmission (the torrent client). All the containers use the same network I created before. I gave to every every container a different container_name and a different alias in the networks section.
After I finished my setup, I run the docker-compose up and tried to go to the Transmission web GUI using the DNS name I setted but I’m always redirect to the first container I got up. If I try to reach the GUI using IP:PORT, I’m able to open the right container so they are both up&running.
Here I post a snippet from the Transmission docker-compose:
As you can see, container name and network alias are different.
After I found out this solution isn’t working, I tried to change the service name, so I changed the service name in File #2 from “transmission” into “transmission2”.
I rebuild my containers and run the docker-compose up and everything just worked fine.
I searched in the documentation and in different forums but I didn’t find out anything useful to understand what is the problem. In the articles I followed to setup my environment I always read that the thing that has to be different is the container name and not the service name.
From what I see, I can suppose that I can’t have different services with the same name in the same network because something is in conflict, probably because of the same name.
Can someone help me to understand? Probably I miss something about networks and services because of my limited experience and I would like to understand better this behaviour.
Thank you in advanced.