here my situation: I have a docker-compose with some container configured in the same networks. I need that all the containers can communicate with all others, and some of these container had an environment where i need to set the endpoint of another one, like this example:
containerA:
image: imageA:0.0.1
port:
- "8080"
network:
- net1
containerB:
image: imageB:0.0.1
environments:
- BRIDGE: http://containerA:8080
network:
- net1
I need now to translate this docker-compose to an ECS Service (one Task for containerA and one Task for containerB). I'm using ecs-cli without any problem, i can create a Cluster, run services with Fargate, run all the task inside the same VPC, using the same Security Group, and i enabled Service Discovery for all the ECS Services, using the same namespace for all (so i have containerA.namespace1 and containerB.namescape1). But i have a problem in the connection between this two tasks: i try so set:
BRIDGE: http://containerA:8080
BRIDGE: http://containerA.namespace1:8080
BRIDGE: http://containerA.namespace1.local
BRIDGE: http://containerA.namespace1.local:8080
but all this options doesn't work. I try a "temp" solution for this problem using the public ip generated from taskA, but if i update the task A, the public IP rightly changes and i need redeploy also taskB. So, the question is: how i can use "hostname" so i can connect to the name of the service and not to the public ip of the task? thanks for any suggestion