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.
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