Original: https://stackoverflow.com/a/46557336/3155344
Put content to /etc/systemd/system/limit-docker-memory.slice
file. Then add a line "cgroup-parent": "limit-docker-memory.slice"
to /etc/docker/daemon.json
. Then restart the docker: systemctl daemon-reload; systemctl restart docker