Friday, February 25, 2022

How To Set Docker Memory and CPU Usage Limit

 in This Tutorial you will Learn " How to Set Docker Memory and CPU Usage Limit On Rock Linux 8.5"

Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; docker-compose --version ; docker --version

docker run -it --memory="[memory_limit]" [docker_image]
Example. - docker run -it --memory="1g" ubuntu

Set Swap to Disk Memory Limit -  docker run -it --memory="[memory_limit]" --memory-swap="[memory_limit]" [docker_image]
Example - docker run -it --memory="1g" --memory-swap="2g" ubuntu

Set Soft Limit to Container Memory-
docker run -it --memory="1g" --memory-reservation="750m" ubuntu

Limit Docker Container CPU Usage- docker run -it --cpus="1.0" ubuntu
docker run -it --cpus-shares="700" ubuntu
_________________________________________________________________________________________

No comments:

Post a Comment