Search code examples
amazon-web-servicesnetwork-programmingdockercontainersamazon-ecs

ECS network host mode and links = CannotCreateContainerError: Container already exists


I'm using AWS ECS to deploy my group of docker containers and in bridge network mode all works perfectly but with a slow performance...

I've read that this problem resolves with a host network mode but if i use this, it causes an error on containers deploy (some of them), "CannotCreateContainerError: Container already exists".

Looking for the error, i've see that is caused by links in containers (https://github.com/aws/amazon-ecs-agent/issues/185) but i need it,

Any ideas of this?

Thanks a lot!


Solution

  • Solved!

    Like in that issue comments, networkmode host don't allow links between containers, so if you remove them it works.

    So now we have a new problem, how comunicate between containers? easy, point to localhost or 127.0.0.1 and its own port (obviously you can't deploy two containers with the same port).