Amazon-ecs-agent: Link not working two ways in ECS

Created on 14 Jun 2018  路  2Comments  路  Source: aws/amazon-ecs-agent

Hi,

I have an ECS task which has three containers A B and C.
In the task definition when defining container B, I have linked A. I gave A container link name as A only.
I have defined hostname of A B and C as A B and C
The task run on single EC2 instance machine.

While running from the docker container B I am able to ping A with the FQDN but from the container A I am not able to ping B.

Also, I am not able to link A container with B as it states as the loop.

This works well in docker compose on my local machine and only in ECS it fails.

I searched and found this could happen where there are multiple EC2 machine but not on one EC2 machine. My case I have only one EC2 machine.

Is there any simple workaround for this?
Note: Service discovery seems to be a complex, suggest some simple workaround if not give easy steps for creating a service discovery for this one ECS task.

Also, I am planning to use AWS Fargate so host file copying solution won't work for me.

kinquestion

Most helpful comment

@anasokan This seems like the same issue as #1166. As the Docker link option doesn't support bidirectional communication, you can try to use the awsvpc network mode, where all containers will be in the same network namespace so they can directly talk to each other.

Also, I am planning to use AWS Fargate so host file copying solution won't work for me.

In Fargate the task is launched with awsvpc mode, all the containers in the same task can directly talk to each other using localhost without the link option required.

Please let us know if the awsvpc mode solves your problem.

Thanks,
Peng

All 2 comments

@anasokan This seems like the same issue as #1166. As the Docker link option doesn't support bidirectional communication, you can try to use the awsvpc network mode, where all containers will be in the same network namespace so they can directly talk to each other.

Also, I am planning to use AWS Fargate so host file copying solution won't work for me.

In Fargate the task is launched with awsvpc mode, all the containers in the same task can directly talk to each other using localhost without the link option required.

Please let us know if the awsvpc mode solves your problem.

Thanks,
Peng

Closing issue for now since we haven't heard back in a while. Please reopen if needed. Thanks.

Was this page helpful?
0 / 5 - 0 ratings