CPU Stressing Docker

To bypass the idle compute identification bu oracle we need to have the CPU, Memory and Network cross a certain level of utilization (as of writing this document it was 20%).

We already talked about stress-ng. Another way to stress the resources is LookBusy script on docker so lets get to it.

First install docker dependeicies and then docker

sudo apt install -y curl wget socat
sudo curl -fsSL https://get.docker.com | sh

Then create a lookbusy container by using this script https://github.com/kejilion/docker/blob/main/fogforest

sudo docker run -itd --name=lookbusy --restart=always \
    -e TZ=Asia/Kolkata \
    -e CPU_UTIL=15-35 \
    -e CPU_CORE=2 \
    -e MEM_UTIL=0 \
    -e SPEEDTEST_INTERVAL=120 \
    fogforest/lookbusy

Required docker files will be downloaded and container will be initiated

  1. Memory usage, unit %, can be omitted if the memory is not running

  2. Network speed test interval, in minutes, can be omitted if you are not running the network

  3. The number of cores occupied by the CPU will run on all cores by default if not specified. If the CPU is full, you can specify 1 core.

  4. CPU usage, unit %, cannot be omitted, supports fixed value or range

Another configurtion with only CPU usage in both core, no memory and smaller network interval

sudo docker run -itd --name=lookbusy --restart=always \
    -e TZ=Asia/Kolkata \
    -e CPU_UTIL=19-30 \
    -e SPEEDTEST_INTERVAL=30 \
    fogforest/lookbusy

You can check the docker status by running

sudo docker container ls

Stop/Start docker container lookbusy instance by running

sudo docker stop lookbusy
sudo docker start lookbusy

Terminate docker container lookbusy by running

sudo docker rm lookbusy

Last updated