Search code examples
linuxdockeriocgroups

How to limit disks IO of Docker container?


I am working with Docker containers and observed that they tend to generate too much disk IOs.

I found the --device-write-bps option which seem to address my need of limiting the disk IOs.

However, this option expects a path to a device, but the latest Docker drivers do not allow me to determine what to set (device is overlay with overlay2 storage driver). Here is what df -h outputs in my case:

Filesystem      Size  Used Avail Use% Mounted on
overlay          59G  5.3G   51G  10% /
tmpfs            64M     0   64M   0% /dev
tmpfs           994M     0  994M   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/vda1        59G  5.3G   51G  10% /etc/hosts
tmpfs           994M     0  994M   0% /proc/acpi
tmpfs           994M     0  994M   0% /sys/firmware

Is the option compatible with the latest drivers? If yes, would someone know what is the path to set?

Thanks!


Solution

  • It seems I was mistaken by the doc. The device to specify for the --device-write-bps option is the device of the host machine. So the mount command is useful, but needs to be run on the host ^^