I'd like to limit both total memory consumption for a group of containers as well as memory consumption for a particular container.
Say, a container is allowed to consume not greater than 1Gb and all containers are allowed to consume 4Gb max.
The question is:
Will I achieve my goal if I create a cgroup with 4Gb memory limit then run my containers as the following:
docker run --memory=1G --cgroup-parent=my-4Gb-cgroup <image-id>