Reputation: 115
By default, the Docker Compose CLI deploys to Fargate in an ECS context. This AWS blog post mentions the following:
In general, the compute mapping is such that all ECS tasks are backed, by default, by AWS Fargate. However, there are scenarios that are not yet supported by Fargate that require the Compose CLI mapping to fall back to use EC2. For example, when you request GPU support for a container.
My application does not need GPU support, but I would still prefer to use EC2 over Fargate because Fargate does not have a free tier (see this post on Serverfault). It seems like this has been proposed for a while (first in April of 2020) but so far there hasn't been any movement.
So in the meantime, is there a way to deploy to EC2 using the Docker Compose CLI?
Also, if this is better suited to a different stackexchange then let me know and I will move it.
Upvotes: 2
Views: 1378
Reputation: 21
If you have to stick with the docker compose integration with ECS, you can use the docker compose convert
and modify the Cloudformation template to use the EC2
launch type, but you have to manually upload this cloud template using AWS CLI (which does not make to much sense to use docker compose
in the first place).
If you need to use EC2
, I would recommend the ecs-cli
. You can create the cluster with one of the both launch types (FARGATE or EC2) and the command is also able to place the containers described in a compose file in the underlying EC2 instance running on ECS. (There is a great tutorial right here)
Upvotes: 2