Docker in MacOs is very slow

As a matter of fact, Docker needs a plain Linux kernel to run. Unfortunately, Mac OS and Windows cannot provide this. Therefore, there is a client on Mac OS to run Docker. In addition to this, there is an abstraction layer between Mac OS kernel and applications (Docker containers) and the filesystems are not the same. Because of that, Docker runs on Mac OS slowly. You are not able to run the Docker on Mac OS like on Linux.

If I need to give some instances about real use-cases. I have the same machine. So, I use Symfony 4 on Docker v18 on Mac OS Mojave. This is my Symfony total execution time on Docker. (Obviously, it depends on your frontend and database queries but I try to enlighten you for main logic.)

  • first time rendering 12000 ms
  • with Symfony cache: 344 ms
  • with Docker cache(:cached property of Docker for volumes): 195 ms

As long as I use Symfony without Docker, the following is my total execution time.

  • without Docker, with Symfony cache: 82 ms

Whereas, we could do some improvements to get better workspace. For example, you can use volumes like this,

volumes:
        - .:/application:cached

Leave a Comment