Under the hood, Docker for Mac is running an Alpine Linux virtual machine. This guide helps with issues related to communication between OS X/macOS and this VM, and running up against limits on the size of the disk allocated to the VM.
Speeding things up
Disable sync on flush
This speeds up write operations involving containers. The tradeoff is increased risk of data loss: pending writes will be lost if your computer, Docker, or a container crashes. Since Docker for Mac is used for development, not production, this may be a good tradeoff to make. Here's how:
References:
- https://gist.github.com/mkrakauer-rio/e7d9de75f5ac680e790365748ca188a4
- https://dzone.com/articles/docker-for-mac-performance-tweaks-1
overlay2 storage engine
If you installed Docker for Mac a while ago, it's probably using the aufs storage engine. overlay2 is a newer, more performant storage engine. From https://docs.docker.com/engine/userguide/storagedriver/selectadriver/#docker-ce:
When possible, overlay2 is the recommended storage driver. When installing Docker for the first time, overlay2 is used by default. Previously, aufs was used by default when available, but this is no longer the case.
On existing installations using aufs, it will continue to be used.
Elsewhere, this page says:
Docker for Mac and Docker for Windows are intended for development, rather than production. Modifying the storage driver on these platforms is not possible.
But this is not true: you can use overlay2 with Docker for Mac.