Use of --device-read-bps and/or --device-write-bps, with volumes

Docker Desktop for Windows: 2.2.0.3 (42716) stable
base image: Alpine:latest

I’m trying to limit the I/O of an image volume, currently running on a Windows host, but may eventually run in GCP.

I’m struggling to understand what devices can have IO limits applied.

Using /dev/loop works fine:
docker run --device-read-bps /dev/loop0:1024 -it alpine

However the following fails:
docker run --device-read-bps /dev/sda1:1024 -it alpine

docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused “process_linux.go:449: container init caused “process_linux.go:415: setting cgroup config for procHooks process caused \“failed to write 8:1 1024 to blkio.throttle.read_bps_device: write /sys/fs/cgroup/blkio/docker/6fec407afeed1b0e0150f19c58118aa0dab2375147d3ec4145b65339d95ff44a/blkio.throttle.read_bps_device: no such device\”””: unknown.

The error ‘no such device\""": unknown.’ confuses me; why does it work with /dev/loop0 but not /dev/sda1, when neither device is listed using ls -al /dev.

The Docker source code indicates that the device must be under /dev or an error is generated.

I understand that this functionality depends on cgroups and blkio, both of which appear to be enabled and started on alpine.

I think it also needs a block device, but volumes under Windows are mounted using grpcfuse which doesn’t appear to be a block driver.

Can this be made to work under Docker for Windows? If so, please show me how.

Does this work ‘out of the box’ with a Linux host for Docker, or are there still special considerations for how the volume is mounted?

Thanks

1 Like