Written by Rich Samartino
Local development can be a great tool for developers to have complete control over a Magento installation and make any changes they need without affecting other coders or testers. However setting up multiple local installations of a complex application like Magento 2 can be a challenge. Docker (https://docs.docker.com/install/) is a great tool to install and connect the technologies needed to develop Magento locally but has presented a major pain point on Windows and Mac operating systems due to the time-consuming need to sync (http://docker-sync.io/) all files on the Windows/Mac filesystem with the Docker container.
That may all change soon for Windows users with the upcoming release of WSL 2 (https://docs.microsoft.com/en-us/windows/wsl/wsl2-index), a new version of Windows Subsystem for Linux (WSL). WSL allows Windows users to install a Linux distribution with certain limitations, including the inability to fully install Docker. WSL 2 removes (https://docs.microsoft.com/en-us/windows/wsl/wsl2-about) this restriction and vastly improves file system performance, meaning a Windows developer can experience developing locally with Docker how it was meant to be: extremely fast performance efficiently leveraging the host machine’s resources without the overhead of syncing thousands of Magento files each time a container is built.
Though a preview edition of Windows is required to get WSL 2 today, I’ve been experimenting with it for the past few weeks and can report that the performance is fantastic and removes most of the issues with local Magento development with Docker and Windows. There are a few issues, however, that I have a feeling will be worked out before the official WSL 2 release (hopefully sometime in early 2020). For example, accessing Linux applications from Windows, and Windows applications from Linux has been a bit buggy. Sometimes http://localhost resolves to the Docker container, other times I have to manually set the Magento base urls to whatever my WSL’s IP address is after a system restart. The WSL 2 version of Docker for Windows (https://docs.docker.com/docker-for-windows/wsl-tech-preview/), which is still in preview, died on me after I restarted my computer, so I’ve been running Docker from inside the WSL itself. This means I have to manually set the Xdebug remote host to my Windows machine’s ip address instead of using the host.docker.internal (https://docs.docker.com/docker-for-windows/networking/) DNS name. Also, WSL 2 is not fully supported in PhpStorm yet (https://youtrack.jetbrains.com/issue/IDEA-197573). As a workaround I’ve been loading my WSL 2 files as a volume mount which makes indexing and some other code analysis features slower.
Still, the improved performance and lack of file syncing has made local development much better, and with these issues resolved it should be close to perfect.
How Can Crimson Agility Help you Graduate to Magento Commerce 2?
We have migration options! We offer three MAGENTO QUICK START PACKAGES that are fixed-cost implementation solutions. Our packages offer great price points whether you are a small business or large enterprise wanting to move to Magento Commerce. Making the move doesn’t have to be hard and will result in improved security & performance, seamless shopping everywhere with PWA, increased conversion rates, more streamlined operations, and a better overall end-user experience.
Contact us today and learn more, we are here to help and love what we do.
About Author: Drawn to the open source, modern architecture of Magento 2, Rich Samartino has channeled his passion for technology into mastering the trade of E-Commerce Engineer. Originally an IT major, Rich spent several years away from technology exploring many ‘offline’ aspects of life, picking up skills such as knitting and guitar-playing, but eventually gravitated back to technology to build web applications for several nonprofits. With the seed of object-oriented web development planted, Rich continued to blossom as a web developer with an innovative sleep technology company, playing an integral role in launching its new Magento 2 website. Hungry for more Magento 2 experience, Rich has landed at Crimson Agility, where he looks forward to applying his talents to build you a great website!