memory_limit in docker module

67 views
Skip to first unread message

Anand Nalya

unread,
Mar 18, 2015, 11:20:51 AM3/18/15
to ansible...@googlegroups.com
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:

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

Jon Soul

unread,
Mar 18, 2015, 11:29:18 AM3/18/15
to ansible...@googlegroups.com
Have you tried converting to an integer with the int filter? 

memory_limit="{{memory|int}}"

(untested)

Anand Nalya

unread,
Mar 18, 2015, 11:44:23 AM3/18/15
to ansible...@googlegroups.com
That didn't work but 262144B or 1GB worked.
Reply all
Reply to author
Forward
0 new messages