mbellido
mbellido

Reputation: 101

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!

Upvotes: 3

Views: 3701

Answers (2)

mbellido
mbellido

Reputation: 101

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).

Upvotes: 2

Pedro Graber
Pedro Graber

Reputation: 361

Essentially, Fargate requires usage of awsvpc as network mode, virtue of which, you wont be able to use "dnsSearchDomains, dnsServers, extraHosts, disableNetworking and hostName" in the task definition when using Fargate launch type.

When any of the above parameters are in your taskdefinition, the error " STOPPED(CannotCreateContainerError: container already exists)" will occur.

However, ECS team acknowledged that the above can be very useful features and working on enabling these parameters.

https://forums.aws.amazon.com/thread.jspa?threadID=250147

Upvotes: 0

Related Questions