Docker, Optimisation
Speeding up local development while using Docker for Mac
Bristol WordPress expert and studio owner
While Docker can be very efficient for production environments, it may not as speedy in development setups. There is an infamous Github issue called “Issue 77” about this topic, specifically Docker Desktop for Mac OSX. Since it was opened there have been over 200 comments on the post.
There is a workaround to help speed increases, yet it’s frustratingly hard to find in the thread. The main issue revolves around volumes and mounting, so caching can help reduce this latency.
If we take the start of a simple docker-compose file:
services:
php:
build:
context: .
dockerfile: Dockerfile
image: atomicsmash/php
volumes:
- .:/var/www/html
… adding rw,cached to the volume definition will invoke the required caching:
services:
php:
build:
context: .
dockerfile: Dockerfile
image: atomicsmash/php
volumes:
- .:/var/www/html:rw,cached
Speed comparison
In this test case, I’m running my local development copy of this WordPress site, through Docker, with and without volume caching. I tried to load the wp-admin dashboard while running the 2019 theme and record the results:

The total page load time is around 7500 milliseconds, I could, however, start interacting with the page after about 7 seconds. This amount of time feels painfully slow while developing. Next test, this time with caching:

This gave a total load time of 2980 milliseconds, and page interactivity at around 2850 milliseconds.
That’s over twice as fast! Hope this helps someone how may be facing this issue with Docker Desktop for OSX.