docker update can't increase both memswap_limit and mem_limit at the same time #22167
Description
Output of docker version
:
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 22:37:33 2016
OS/Arch: darwin/amd64
Server:
Version: 1.11.0
API version: 1.23
Go version: go1.5.4
Git commit: 4dc5990
Built: Wed Apr 13 19:36:04 2016
OS/Arch: linux/amd64
Output of docker info
:
Containers: 11
Running: 1
Paused: 0
Stopped: 10
Images: 31
Server Version: 1.11.0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 49
Dirperm1 Supported: true
Logging Driver: json-file
Plugins:
Volume: local
Network: bridge null host
Kernel Version: 4.1.19-boot2docker
Operating System: Boot2Docker 1.11.0 (TCL 7.0); HEAD : 32ee7e9 - Wed Apr 13 20:06:49 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.956 GiB
Name: default
ID: A3ER:5IO7:G4N4:MUOQ:444G:PQGG:JJEG:WI7N:KS2O:BIH6:BNS6:F6U6
Debug mode (server): true
File Descriptors: 18
Goroutines: 38
System Time: 2016-04-19T19:20:11.746721662Z
EventsListeners: 0
Init SHA1:
Init Path:
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
provider=virtualbox
Additional environment details (AWS, VirtualBox, physical, etc.):
VirtualBox/docker-machine on a Mac
Steps to reproduce the issue:
- docker run -d --memory-swap 512M --memory 512M --name test-container alpine /bin/sh -c "while true; do sleep 10; done;"
- docker update --memory-swap 1024M --memory 1024M test-container
Describe the results you received:
Failed to update container (test-container): Error response from daemon: Cannot update container 586038e6de5be631345e7f87bf277441c1a5a397451bb85481f790c2dc607837: rpc error: code = 2 desc = "failed to write 1073741824 to memory.limit_in_bytes: write /sys/fs/cgroup/memory/docker/586038e6de5be631345e7f87bf277441c1a5a397451bb85481f790c2dc607837/memory.limit_in_bytes: invalid argument"
Describe the results you expected:
I expected it to work.
Additional information you deem important (e.g. issue happens only occasionally):
If you individually set --memory-swap
before --memory
, it works:
$ docker update --memory-swap 1024M test-container
test-container
$ docker update --memory 1024M test-container
test-container
I imagine the problem is that the memory can't be higher than the memory + swap, but if you set both, it should be smart enough to apply them in the correct order (IMO).
Activity