-
-
Save marabesi/6a4e6b969d259c9e0ded7605b77635ef to your computer and use it in GitHub Desktop.
Limit docker CPU and memory resource usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
systemctl daemon-reload | |
systemctl restart docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/docker/daemon.json | |
{ | |
"cgroup-parent": "limit-docker-resource.slice" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/limit-docker-resource.slice | |
[Unit] | |
Description=Throttle CPU usage to 70% and memory usage to 8GB for docker-spawned processes | |
Before=slices.target | |
[Slice] | |
CPUQuota=70% | |
MemoryAccounting=true | |
MemoryLimit=8G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inspired by: https://stackoverflow.com/questions/46408673/docker-17-06-ce-default-container-memory-limit-on-shared-host-resources/46557336#46557336 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment