author Magesh

Fixed: Slow PostgreSQL docker container on M1 Mac

Magesh Ravi on May 12, 2022

I have been using Docker for all my development projects since 2018. I bought an M1 Mac last year and have been facing performance issues while working on PostgreSQL containers. Some queries took up to 15 seconds at times.

After months of searching for solutions online, I have found the fix. It relies on two new features from Apple,

  1. A new virtualisation framework that replaces the existing hypervisor framework
  2. A new filesystem with accelerated directory sharing that improves I/O for Docker volumes

Docker has marked these features as experimental, which means they are NOT stable yet. You can enable these settings by going to Docker > Preferences > Experimental Features and checking the two options listed (See screenshot).

docker-for-mac-settings

You might not see any performance boost until you have destroyed existing containers, removed associated volumes and re-provisioned them again.