Docker Desktop for Windows uses Windows-native Hyper-V virtualization and networking and is the fastest and most reliable way to run. It is a native application that provides an easy-to-use development environment for building, shipping, and running dockerized apps. Docker Desktop for Windows is Docker designed to run on Windows 10 and macOS.
![]() LinuxI was not joking, seriously Linux is also an option for Mac users. In my opinion mutagen is the best option to improve performance, if you want to stick with Docker for Mac. Improvement is very noticeable. Files synchronization PhpStormAll PHP developers probably know this IDE and probably most of you are using it. I will not describe the whole setup here, it is not in the scope of this post, but because file synchronization performance is a main topic, I can briefly mention what tools I used for that purpose. set up the virtual machine with a whole Linux based environmentBut you need to do this only once. Linux on VirtualBoxI came up with this solution before mutagen was available and I had been using it for a quite long time before I switched to a different (but similar) approach.It is a little bit tricky to configure because you must: It is really fast, and it does not influence performance. You can test your application on your normal browser by just going to the virtual machine IP address. Thanks to that you can work on your project on your Mac like always and all changes will be sent to the virtual machine, where you have Docker running. It is easy to configure, it supports automatic upload and many other features. This build-in tool is called Deployment and allows to sync files for example by SFTP. Gltche app for macJust place a file called mutagen.yml inside project directory with content like this:Sync : defaults : ignore : paths : -. It can also handle such tasks.Configuration is very easy, you can have different ones for each project. MutagenI had been using PhpStorm for some time for the files sync and then I decided to try another tool, mentioned here Mutagen. Docker For Windows On Archive To ImproveSo syncing the whole project won’t take so much time like in the case of PhpStorm based sync. It also collects changed files and sends them as an archive to improve performance. From now your files will be automatically synced with a virtual machine, there are almost no delays and it is a very stable solution. To start synchronization just run mutagen project start. Linux on VPSDocker is a quite resource-consuming tool, does not matter if you are using Docker for Mac or VirtualBox, it will require a lot of CPU and RAM. I would even say that this difference is within measurement error. Also, it performs only a little bit better than mutagen. The result for mutagen on Docker for Mac is added to this chart to make the comparison easier.As you can see, the difference between different volume options is not big. It has a little bit fewer resources than I gave to VirtualBox, this is why it is also a little bit slower.The main advantage of such a solution is overall Mac performance while using Docker.Docker is running on a different machine so we have whole Mac RAM and CPU for other tasks. The main difference is that VPS can be accessed from a public network, so it would be nice to properly secure it with a firewall, VPN, etc.So it is not trivial but I think that everyone with basic DevOps knowledge will be able to configure such an environment.I’m using quite cheap VPS, which is not too powerful. Such an approach has one more advantage, it is easily scalable, if you need more RAM, CPU or disk, you can add it.Configuration and setting everything up do not differ much from VirtualBox setup. All heavy tasks can be performed by another machine, Linux based, without performance issues. It may be also related to the network connection. A similar time is needed for building a container on VirtualBox.What is interesting is that when I did the same test on VPS it was much faster than in other cases. It is generally time-consuming, but can be done in a relatively short time and can also take an hour or more.As you can see Docker for Mac is slow not only in the case of processing requests but it is even worse in the case of building the docker image.Setting up mutagen will shorten this time to a little bit over half of an hour. From time to time there is a need to build Docker containers from scratch. Build time comparisonThis is another aspect I did not mention yet. Everything is so slow that the better thing to do during Docker build is to take a break and go for a walk. It is always taking a lot of resources, and it is almost impossible to use a computer during this time. It does not matter if I build a container on VirtualBox or directly on Mac.
0 Comments
Leave a Reply. |
AuthorCharlene ArchivesCategories |