in Docker

Improve Docker Performance On MacOS

If you've moved your development practices to use docker then you may of noticed that there is a performance difference than running on the native infrastructure.

Here are some tips you can use to speed up docker on your local machine, especially for developers using MacOS.

Volume optimisations

This has the biggest affect on your docker performance on your local machine, if you can improve you volume caching then this will massively improve loading speeds of your application.

As of Docker 17.04 two new options have been added to your docker volumes of cached and delegated.

In some cases you want an exact sync between the files on your container and the files on your local machine. Choosing the right file system cache will help to improve the performance of your development environment.

  • consistent: perfect consistency (host and container have an identical view of the mount at all times)
  • cached: the host’s view is authoritative (permit delays before updates on the host appear in the container)
  • delegated: the container’s view is authoritative (permit delays before updates on the container appear in the host)

I tend to get the best performance using the delegated cache option.

Increase System Resources

If your machine has a enoughg resources then consider assigning more resource to the docker engine. Under the docker menu select preferences then go to resources, the default RAM is 2GB I would recommend increasing this to atleast 4GB. If you containers are doing any intensive processing then consider increasing the CPU amount.

Docker For Mac

Make sure you're running the latest version of Docker on your Mac. They are always making progress on increasing the performance of Docker on your mac so make sure you stay up to date with these changes.

Subscribe To The Weekly Newsletter

Get weekly updates to your email