<p>There are two important parameters that you can use wisely to deal with AWS ECS task definition. </p>

<p><a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html" rel="nofollow noreferrer">memory</a>: </p>

<blockquote>
  <p>The hard limit (in MiB) of memory to present to the container. If your
  container attempts to exceed the memory specified here, the container
  is killed.</p>
</blockquote>

<p><a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html" rel="nofollow noreferrer">memoryReservation</a>: </p>

<blockquote>
  <p>Docker attempts to keep the container memory to this soft limit;
  however, your container can consume more memory when it needs to.</p>
</blockquote>

<p>I recommend you to go with <strong>memoryReservation</strong>. So your task definition will look like this. </p>

<pre><code>{
  "family": "my-alpine",
  "networkMode": "bridge",
  "containerDefinitions": [
    {
      "image": "alpine:latest",
      "name": "my-alpine",
      "memoryReservation": 100,
      ...
      ...
    }
  ]
}
</code></pre>

CC BY-SA 3.0
2017-08-21T14:10:40.727Z
2017-08-21T14:10:40.727Z
sithumc
<p>We are using <strong>alpine</strong> image on AWS ecs which work fine on just 100mb memory in task definition.
Now we need ubuntu image which size is more then 180mb while alpine is just 5mb.</p>

<ul>
<li><p>I want to know that we need to increase memory according to image?</p></li>
<li><p>or Docker image run completely in memory or just current processes in memory what if I specify memory less then docker image size in task definition?</p></li>
</ul>

<p>AWS recommend 300 to 500mb but in development I want to save memory.</p>

<p>Thanks</p>

CC BY-SA 3.0
2017-08-21T08:21:04.327Z
It's a little confusing what do you actually mean by "memory", usually it is RAM size, but you specify image size, which consumes disk space, but not RAM. So if you mean memory as RAM, then alpine and ubuntu will consume similar amount of RAM if they run similar application.
oryades
<docker><amazon-ecs>
AWS Task definition memory for Ubuntu docker image
Adiii
# AWS Task definition memory for Ubuntu docker image

(Asked by: username_0 on 2017-08-21)

We are using **alpine** image on AWS ecs which work fine on just 100mb memory in task definition.
Now we need ubuntu image which size is more then 180mb while alpine is just 5mb.

* I want to know that we need to increase memory according to image?
* or Docker image run completely in memory or just current processes in memory what if I specify memory less then docker image size in task definition?

AWS recommend 300 to 500mb but in development I want to save memory.

Thanks

**Tags:** docker, amazon-ecs

> **Comments:**
> **username_1**: It's a little confusing what do you actually mean by "memory", usually it is RAM size, but you specify image size, which consumes disk space, but not RAM. So if you mean memory as RAM, then alpine and ubuntu will consume similar amount of RAM if they run similar application.  

---

## 1 answers

### Answer by username_2 on 2017-08-21. Score: 2 | Accepted answer

There are two important parameters that you can use wisely to deal with AWS ECS task definition. 
memory: 

The hard limit (in MiB) of memory to present to the container. If your
  container attempts to exceed the memory specified here, the container
  is killed.

memoryReservation: 

Docker attempts to keep the container memory to this soft limit;
  however, your container can consume more memory when it needs to.

I recommend you to go with memoryReservation. So your task definition will look like this. 
{
  "family": "my-alpine",
  "networkMode": "bridge",
  "containerDefinitions": [
    {
      "image": "alpine:latest",
      "name": "my-alpine",
      "memoryReservation": 100,
      ...
      ...
    }
  ]
}


---

