'How to talk to independent docker container by name? [duplicate]
I have two distinct docker containers, independent from each other.
Now I want to talk from one to the other. Is that only possible by IP:PORT? Or even by application name?
This is the container I want to talk to:
docker-compose.yml:
services:
my-container:
...
ports:
- "8090:8080"
extra_hosts:
- "host.docker.internal:host-gateway"
Is there a way that another container could simply connect to http://my-container? Or would I always have to go the way injecting the host network ip with extra_hosts to both containers, and then connect with http://host.docker.internal?
Sidenote: all my containers are on the same default docker bridge network.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
