Reputation: 45
I am on a Ubuntu 22.04.4 LTS machine with Docker version 26.0.1, build d260a54
. I am trying to run a container with IO (disk) read and write both rate limited to 50mb/s - this is a low priority container, and I want to ensure that it doesn;t hog the IO bandwidth, essentially. To do this, I am attempting to set this limit using the --device-write-bps
flag when doing docker run
. This is what the output of df -h
on my system looks like:
Filesystem Size Used Avail Use% Mounted on
tmpfs 6.3G 1.2M 6.3G 1% /run
/dev/nvme0n1p3 63G 6.9G 53G 12% /
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/nvme0n1p1 256M 8.6M 248M 4% /boot/efi
ops.utah.cloudlab.us:/share 18T 22G 18T 1% /share
ops.utah.cloudlab.us:/proj/wisr-PG0 100G 54G 47G 54% /proj/wisr-PG0
tmpfs 6.3G 0 6.3G 0% /run/user/20041
Experiment 1: docker run -it --rm --device-write-bps /dev/nvme0n1p3:5mb ubuntu /bin/bash
. The root /
is mounted on /dev/nvme0n1p3
, so I would expect this to be the correct device to ratelimit. Inside the docker container I tried writing to file (and got the following output):
root@4fbcdf56adb0:/# dd if=/dev/urandom of="random_file.bin" bs=1M count="1024"
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.00586 s, 214 MB/s
Expected behavior: This file read should have had a throughput of 5mb/s, not 212mb/s.
Experiment 2: docker run -it --rm --device-write-bps /dev/:5mb ubuntu /bin/bash
- maybe this will rate limit all devices? Output:
root@c03341b547da:/# dd if=/dev/urandom of="random_file.bin" bs=1M count="1024"
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.85882 s, 221 MB/s
root@c03341b547da:/#
This, also, did not work. What am I doing wrong?
Upvotes: 1
Views: 108