# CPU and RAM limit

You can limit CPU and RAM to a container by using the Deploy setting,

### Set Limit

The docker container cannot use MORE than the limit set

<pre class="language-yaml"><code class="lang-yaml"> services:
   container:
<strong>    deploy:
</strong><strong>      resources:
</strong><strong>        limits:
</strong><strong>          cpus: ${CPU_LIMIT:-1}
</strong><strong>          memory: ${MEM_LIMIT:-100M}
</strong></code></pre>

### Set Reservation

These resources are kept available for the container

<pre class="language-yaml"><code class="lang-yaml"> services:
   container:
<strong>    deploy:
</strong><strong>      resources:
</strong><strong>        reservations:
</strong><strong>          cpus: ${CPU_RES:-1}
</strong><strong>          memory: ${MEM_RES:-100M}
</strong></code></pre>

You can use reservations and limits together
