A quick way to speed up Docker

I've heard many devs working on MacOS that their Docker development environment is slow. Enabling these experimental features can be a quick and easy improvement.

Experimental features

In Docker Desktop, go to Settings and then to Experimental features.

Enable "Use the new Virtualization framework" and "Enable VirtioFS accelerator directory sharing".

Press "Apply & Restart".

Screenshot of Docker (version 4.12.0) settings screen with experimental features enabled
Docker's experimental features

Performance

Apache Benchmark can be used to test the performance increase of these features. Using my recently created ab-runner tool simplifies the process.

For each setup, the script made 500 requests to the about page of this blog (running locally on Docker, of course). Response times are averaged over all runs. Docker is running version 4.12.0, MacOS is on version 12.6.

The first run (left) was done with default settings. For the second run (middle) only the new Virtualization framework feature was enabled. The third run (right) also enabled the VirtioFS feature.

Comparison of 3 benchmark tests. When Docker's experimental features are enabled, response times drop from a mean of 785ms to a mean of 232ms.
Comparison plot of 3 ab-runner tests

The results are very clear: response times went down from 785 ms to 232 ms. That is more than 3 times as fast as before!

Naturally, your milage may very, depending on your project and on your machine.

Just give it a go. It takes less 5 minutes to change and might make your developer experience a lot better.



Did this help you out? Share the improvement you saw on your project in the comments. Thanks for reading!

Comments (0)

Got a question? Liked the article or got a suggestion? Leave a comment to let us know.