# Limiting Discourse memory usage on a dedicaded box

**URL:** <https://meta.discourse.org/t/limiting-discourse-memory-usage-on-a-dedicaded-box/19378>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [2014 年 8 月 28 日午前 8:20 UTC](https://meta.discourse.org/t/limiting-discourse-memory-usage-on-a-dedicaded-box/19378 "2014-08-28T08:20:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2014 年 8 月 28 日午後 6:58 UTC](https://meta.discourse.org/t/limiting-discourse-memory-usage-on-a-dedicaded-box/19378/4 "2014-08-28T18:58:39Z")

</div>

I haven’t tested this yet, but changing [line 289 in the current launcher](https://github.com/discourse/discourse_docker/blob/5701c085f4773dce8943ec145a0f808ac5fbef3a/launcher#L289) script to the following should work.

```
$docker_path run $restart_policy "${env[@]}" -h "`hostname`-$config" -m="4g" -e DOCKER_HOST_IP=$docker_ip --name $config -t --cidfile $cidfile $ports \

```

I’ve added `-m="4g"` in order to limit the container to 4GB of memory.

> [@Docker Documentation](#):
>
> -m=“”: Memory limit (format: , where unit = b, k, m or g)

---

_[View the full topic](https://meta.discourse.org/t/limiting-discourse-memory-usage-on-a-dedicaded-box/19378)._
