memory_limit in docker module

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

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

memory_limit=“{{memory|int}}”

(untested)

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