How to speed up Docker on MacOS

jordanbravo

Jordan Bravo

Posted on March 27, 2023

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

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
jordanbravo
Jordan Bravo

Posted on March 27, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

ยฉ TheLazy.dev

About