DEV Community

Jordan Bravo
Jordan Bravo

Posted on • Updated on

How to speed up Docker on MacOS

Problem: Containerization is a feature of the Linux kernel (namespaces + cgroups + chroot) and so MacOS and Windows must run a virtualized Linux environment to use Docker, which has a significant performance penalty.

Solution: To help mitigate this issue, Docker (the company) has some recommended configuration tweaks for optimizing performance on MacOS:

Step 1. In Docker Desktop Settings > General > Choose file sharing implementation for your containers. Select VirtioFS and restart Docker Desktop.

Image description

Step 2. If you’re using any bind mounts, add the delegated option when you specify the mount source and destination in the docker-compose.yml file, for example:

  my-service:
    image: my-image
    container_name: my-container
    volumes:
      - ./my-app:/app:delegated  # this is the relevant setting
Enter fullscreen mode Exit fullscreen mode

References:
https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/
https://docs.docker.com.xy2401.com/compose/compose-file/#caching-options-for-volume-mounts-docker-for-mac

Top comments (0)