Disk speed on Mac host

I’m running an application that reads a large amount of data from the disk, and it’s very slow in Docker running on macOS. I suppose this is due to the multiple layers of filesystem translation taking place, but I’m wondering if there is any way to improve or if this is the best I can do with today’s technology. Outside the container I get 2700 MBps and inside the container I get 200 MBps. I’m benchmarking with a command like this:

fio --directory /media/fio/ --name bigfile --size 10G --bs 1M --rw read

I’m using Docker Desktop 4.11 on macOS 11.6.3. My Docker image is based on python:3.9.

I guess you mounted a directory from the host. The latest macOS (at least 12.2) supports VirtioFS which makes directory sharing faster. If you can’t update your mac to at least 12.2, I don’t think you can do much.

That’s great news, I’ll try updating. Yes I meant to say I’m mounting a directory from the body with —volume

With Monterey and Virtiofs enabled, read speed is 10x faster, now 2000MBps! It didn’t help much with write speed though.