FS#46779 - [docker] Cannot set memory limits

Attached to Project: Community Packages
Opened by Dan Liew (delcypher) - Sunday, 18 October 2015, 15:10 GMT
Last edited by Sébastien Luttringer (seblu) - Thursday, 22 October 2015, 19:52 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Setting memory limits using ``--memory=`` and ``--memory-swap=`` no longer works correctly.


Additional info:
* Docker 1.8.3-1
* Linux dan-sputnik 4.2.3-1-ARCH #1 SMP PREEMPT Sat Oct 3 18:52:50 CEST 2015 x86_64 GNU/Linux
* systemd: 227-1
* cat /proc/cmdline
```
BOOT_IMAGE=/vmlinuz-linux root=/dev/mapper/volgroup-root resume=/dev/mapper/volgroup-swap cgroup_enable=memory swapaccount=1
```


Steps to reproduce:
1. Try running the following

$ docker run --memory=500M --memory-swap=500M -ti ubuntu:latest

you will get an error message

```
Error response from daemon: Cannot start container efab30a5709ed5ef67438cfd19133c72ec74d6950936c66d6d6d2e27f387fe14: [8] System error: open /sys/fs/cgroup/memory/init.scope/system.slice/docker-efab30a5709ed5ef67438cfd19133c72ec74d6950936c66d6d6d2e27f387fe14.scope/memory.memsw.limit_in_bytes: no such file or directory.
```

2. If you try the command above without specifying ``--memory-swap=`` the container will start but a warning shows up in Docker's logs

```
Oct 18 15:55:48 dan-sputnik docker[7070]: time="2015-10-18T15:55:48.989117494+01:00" level=warning msg="Your kernel does not support OOM notifications: open /sys/fs/cgroup/memory/init.scope/system.slice/docker-cd0d56a244162b406f9cad46c81950643c9b8143ddb6e3410901539bab92161c.scope/memory.oom_control: no such file or directory"
```

I've filled this bug upstream ( https://github.com/docker/docker/issues/17151 ) but I thought I should file the issue here too
This task depends upon

Closed by  Sébastien Luttringer (seblu)
Thursday, 22 October 2015, 19:52 GMT
Reason for closing:  Fixed
Additional comments about closing:  docker 1:1.8.3-2
Comment by Dan Liew (delcypher) - Sunday, 18 October 2015, 15:47 GMT
Seems like system-d is responsible for this. I try downgrading to system-d 226-3, it was still broken. I downgraded to system-d 225-1 and the issues went away.

Looks like this issue was also reported upstream at

https://github.com/docker/docker/issues/16256
https://github.com/hashicorp/nomad/issues/171

Apparently passing ``--exec-opt native.cgroupdriver=cgroupfs`` to the daemon fixes the issue. I will report back.
Comment by Dan Liew (delcypher) - Monday, 19 October 2015, 09:41 GMT
``--exec-opt native.cgroupdriver=cgroupfs`` seems to fix the issue.
Comment by Sébastien Luttringer (seblu) - Thursday, 22 October 2015, 15:31 GMT
Another workaround, would also be to disable unified cgroup on recent systemd by putting systemd.unified_cgroup_hierarchy=0 as kernel parameter.

I'll push a new package patching this.

Loading...