# memory\_limit in docker module

**URL:** <https://forum.ansible.com/t/memory-limit-in-docker-module/17773>\
**Category:** Ansible Project\
**Created:** [March 18, 2015, 3:09pm UTC](https://forum.ansible.com/t/memory-limit-in-docker-module/17773 "2015-03-18T15:09:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_Nalya](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@Anand\_Nalya](https://forum.ansible.com/u/Anand_Nalya)\
**Post date:** [March 18, 2015, 3:09pm UTC](https://forum.ansible.com/t/memory-limit-in-docker-module/17773/1 "2015-03-18T15:09:04Z")

</div>

Hi,

I’m trying to set the memory\_limit for my docker container with the following syntax:

- name: start docker image  
docker:  
image=“{{dockerImageName}}”  
command=“{{command}} {{ENVIRONMENT}}”  
memory\_limit=“{{memory}}”

I’ve tried setting memory variable to 262144 but it gives the following error:

```auto
TASK: [start docker image] **************************************************** 
failed: [10.30.2.239] => {"failed": true, "parsed": false} 

```

failed=True msg=‘Could not convert 262144 to integer’

I’ve also tried pass memory=1Gb but it also fails with a similar error. Even hardcoding memory\_limit=262144 does not seem to work. Am I missing something?

Regards,  
Anand

---

<div class="post-metadata">

**Author:** ![Jon\_Soul](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@Jon\_Soul](https://forum.ansible.com/u/Jon_Soul)\
**Post date:** [March 18, 2015, 3:29pm UTC](https://forum.ansible.com/t/memory-limit-in-docker-module/17773/2 "2015-03-18T15:29:18Z")

</div>

Have you tried converting to an integer with the int filter?

memory\_limit=“{{memory|int}}”

(untested)

---

<div class="post-metadata">

**Author:** ![Anand\_Nalya](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@Anand\_Nalya](https://forum.ansible.com/u/Anand_Nalya)\
**Post date:** [March 18, 2015, 3:44pm UTC](https://forum.ansible.com/t/memory-limit-in-docker-module/17773/3 "2015-03-18T15:44:23Z")

</div>

That didn’t work but 262144B or 1GB worked.
