Task Definition size according to Docker image size



I have a Docker image with size ~8GB. When creating a Task Definition I am prompted to fill the Task size (CPU and Memory) and optionally the Container size (CPU and Memory). Even though I've read the info sections it does not come clear to me the difference between the two.

Should I set the size of the Container and the Task to 8 GB? In case the both sizes are less than the image size the container would not run?

asked a year ago604 views
1 Answer
Accepted Answer

The size of the docker image you're referring to seems to be the file size, which wouldn't be impacted by memory limitations. The term memory refers to the component within your computer that allows for short-term data access and is typically used in computing to store working data for a system[1]. [1] https://en.wikipedia.org/wiki/Random-access_memory

When you have a file and save it in a file system it isn't normally stored in memory unless it's been recently accessed, and memory is able to cycle out old cached content as new content is requested[2]. [2] https://www.oreilly.com/library/view/understanding-the-linux/0596002130/ch14s02.html

Now onto the differences between task size and container size. When you register a task definition, you can specify the total CPU and memory used for the task. This is separate from the cpu and memory values at the container definition level. A single ECS task may have many containers running to complete, and in these cases the "Container Size" parameter would limit each container's resource consumption, while the "Task Size" parameter would limit how many total resources your Task may use[3]. [3] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html

In regards to performance issues or launch failures, unless you load too much into RAM at once your task should still run fine, even with your image file being 8 GB. Something good to note though, Task-level CPU and memory parameters are ignored for Windows containers. We recommend specifying container-level resources for Windows containers.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions