Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Fix the minimum memory reservation limitation for Docker change #185

Merged
merged 2 commits into from
Oct 12, 2021

Conversation

0xlen
Copy link
Contributor

@0xlen 0xlen commented Oct 7, 2021

Issue #, if available:

This update is relating to the Docker version change:

In the documentation for task definition parameter it is mentioning the minimum memory for different docker version for memory, however, it did not point out the same constraint for memoryReservation:

Screenshot 2021-10-07 at 16 06 08

If trying to launch a task with 4m as minimum value of memoryReservation, it could be possible to get the following error when using Docker 20.10.0 or later:

CannotCreateContainerError: Error response from daemon: Minimum memory reservation allowed is 6MB

I also can verify this behavior with testing below:

Docker 20.10.7

$ docker run --memory-reservation="4m" nginx
docker: Error response from daemon: Minimum memory reservation allowed is 6MB.
See 'docker run --help'.

$ docker version
...
Server:
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.15.14
  Git commit:       b0f5bc3
  Built:            Tue Sep 28 19:57:35 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker 19.03.13-ce

$ docker run --memory-reservation="4m" nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
07aded7c29c6: Pull complete
bbe0b7acc89c: Pull complete
44ac32b0bba8: Pull complete
91d6e3e593db: Pull complete
8700267f2376: Pull complete
4ce73aa6e9b0: Pull complete
Digest: sha256:06e4235e95299b1d6d595c5ef4c41a9b12641f6683136c18394b858967cd1506
Status: Downloaded newer image for nginx:latest
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
...
2021/10/07 14:48:50 [notice] 30#30: exiting
2021/10/07 14:48:50 [notice] 30#30: exit
2021/10/07 14:48:50 [notice] 1#1: signal 17 (SIGCHLD) received from 30
2021/10/07 14:48:50 [notice] 1#1: worker process 30 exited with code 0
2021/10/07 14:48:50 [notice] 1#1: exit


$ docker version
...
Server:
 Engine:
  Version:          19.03.13-ce
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46
  Built:            Mon Oct 12 18:51:50 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0
  GitCommit:        84113eef6fc27af1b01b3181f31bbaf708715301
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                          PORTS               NAMES
86f2441f4b30        nginx               "/docker-entrypoint.…"   About a minute ago   Exited (0) About a minute ago                       ecstatic_boyd

$ docker inspect 86f2441f4b30 | grep MemoryReservation
	"MemoryReservation": 4194304,

Description of changes:

Update the memoryReservation to include minimum memory for different docker version.

References:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@browndjaz browndjaz merged commit 9d63eb0 into awsdocs:master Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants