1
votes

I am trying to understand if (and if so how) ecs-cli docker-compose registers task definitions.

The aws documentation states that it: "works with a Docker compose file to create task definitions and manage tasks." The ecs-cli-compose docs seem to make no mention of task registration.

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/cmd-ecs-cli-compose.html

However registering a task definition seems to be a rather cumbersome process involving a complex json file, where one defines a i) "family", ii) a set of acceptable container definitions and iii) one or more optional task roles.

http://docs.aws.amazon.com/cli/latest/reference/ecs/register-task-definition.html

Any help in clearing up my confusion would be greatly appreciated.

1

1 Answers

5
votes

Task definition creation and registration are the same thing. So, yes, ecs-cli compose up includes task definition registration, but only if the task definition does not exist yet. If you run up multiple times with the same docker-compose file, the same task definition is used. This is transparent to the user.

You can also perform only the task definition registration (without running the task) with ecs-cli compose create, according to the ECS Developer Guide.

As an example, I created a simple docker-compose.yml file in an ecsclitest directory and ran ecs-cli compose --file docker-compose.yml up. This is the resulting task listed in the AWS ECS console:

enter image description here

The task definition revision is 2 because I had previously run ecs-cli compose up with a different docker-compose file.