What is the best way to find containers in network?

Hi there! I have some containers behind a reverse proxy and I have them all in a network. From the rProxy interface I connect to them by calling their container_names. But I have discovered that I can call them by their Docker Compose service names too. I wonder what is the best way to find them in the network? Container names (the ones that are also set as network names) or Compose service names? (rProxy and the services are not in the same compose.)

It doesn’t really matter if you use the container name or service name. Both work, as long as the containers are attached to the same user defined network. The dsn-based service discovery is an aspect of the network, not of the compose project itself.

Personally, I only use service names. I usually don’t configure container names, unless the absence of the container name would prevent the container from doing its job.


Understood. Thanks for taking your time!