# docker\_container module always fails to update 'kernel\_memory' attribute on a running container.

**URL:** <https://forum.ansible.com/t/docker-container-module-always-fails-to-update-kernel-memory-attribute-on-a-running-container/28056>\
**Category:** Ansible Project\
**Created:** [July 16, 2018, 9:12am UTC](https://forum.ansible.com/t/docker-container-module-always-fails-to-update-kernel-memory-attribute-on-a-running-container/28056 "2018-07-16T09:12:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishan\_jain](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ishan\_jain](https://forum.ansible.com/u/ishan_jain)\
**Post date:** [July 16, 2018, 9:12am UTC](https://forum.ansible.com/t/docker-container-module-always-fails-to-update-kernel-memory-attribute-on-a-running-container/28056/1 "2018-07-16T09:12:03Z")

</div>

Hi,

I had some containers started with some attributes as variables, values of which i wish to control later. So consider this docker task:

`

- name: Start container  
docker\_container:  
name: “{{cname}}”  
image: “{{ image }}”  
state: started  
memory: “{{ mem }}”  
memory\_reservation: “{{ memr }}”  
memory\_swap: “{{ mems }}”  
kernel\_memory: “{{ kernelMemory }}”  
`

I start some container with kernelMemory set to 0 and it works fine.  
Now i wish to only update the kernel\_memory, so i set kernelMemory: 1g or and re run the same playbook, but it fails with the following error:

fatal: [docker1]: FAILED! =\> {“changed”: false, “msg”: “Error updating container 06ad86660ce32f36267784c: 500 Server Error: Internal Server Error ("{"message":"Cannot update container 06ad86660ce32f36267784c: Can not update kernel memory to a running container, please stop it first."}")”}

Ok so it doesn’t allow that on running container, but shouldn’t there a provision in the module to restart/recreate the container if something has changed ? The module does that for other values. If this is supposed to happen like this, then i think at least the documentation needs to be updated as i am finding out this behavior only when i have a lot of containers already running, now i will have to kill them all first.

BR,  
Ishan

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [July 24, 2018, 4:23pm UTC](https://forum.ansible.com/t/docker-container-module-always-fails-to-update-kernel-memory-attribute-on-a-running-container/28056/2 "2018-07-24T16:23:56Z")

</div>

Hi Ishan,

have you filed an issue on github for this? That increases the chance  
that the docker\_container maintainers find out about this 🙂

Cheers,  
Felix
