Setting up Magento 2 with Docker on Windows 10

Setting up Magento 2 with Docker on Windows 10


  • Cygwin
  • Hyper-V
  • PHP for Windows
  • Composer for Windows
  • Docker for Windows
  • Kitematic
  • Docker Containers: PHP-FPM, Nginx, MySQL

Installing Cygwin

Visit and download the x64 exe file (or x86 if you are on a 32bit system).

Once you have install Cygwin, install apt-cyg package manager straight away. You can do that by visiting

Finally, once apt-cyg is installed, you can do the following from within a Cygwin terminal:

apt-cyg install nano
apt-cyg install git
apt-cyg install mysql
apt-cyg install gzip
apt-cyg install curl

Installing Hyper-V

To install Hyper-V, do the following as mentioned by howtogeek:

“To launch the Control Panel, right-click the Start button or press Windows+X on your keyboard, then select “Control Panel” from the menu that pops up. Click “Programs” in the list and then select “Turn Windows features on or off” under “Programs and Features”

If you scroll down in this list, you should see the Hyper-V options which you will need to enabled, and then you will be required to restart your machine.

Installing PHP on Windows

Go to and download the x86 zip file for PHP 5.6. Extract that to a folder of your choice – I put mine in d:\php. PHP is set up by default to work from c:\php – this can be changed, but if you don’t want to, extract it to c:\php so the default setting works.

You will need to enable a few modules in php.ini so that n98-magerun works along with some other bits such as MySQL. To do this, copy php-development.ini to php.ini from within your PHP folder. Now open your newly created php.ini and uncomment the following lines:


Note: if you want to change the directory for PHP, add “extension_dir = D:\php\ext” and change the location to your PHP directory.

Also uncomment the following:

always_populate_raw_post_data = -1

Install Composer for Windows

Download Composer-Setup.exe from: and run it. Hopefully, it should install without any issues.

Any issues are likely to be related to a missing php extension. If you see an error, don’t panic. Take your time to read the error and see what the issue is. If it’s an extension then open php.ini and uncomment the required extension.

Installing Docker for Windows

Visit and download the installer. Once it’s finished downloading, run it and it will install Docker onto your Windows system.

Installing Kitematic

It’s best to simply install Kitematic rather than install the Docker Toolbox. Docker Toolbox wants to install docker-compose, virtualbox etc. We’re going to be using Hyper-V so we don’t need virtualbox, and docker-compose (and the other docker apps) are best managed by installing Docker for Windows.

You can download Kitematic here: – grab the latest version and extract the downloaded file. You should now have a folder called “Kitematic-Windows

If you want to launch Kitematic from the Docker taskbar icon (by right-clicking), you will have to copy “Kitematic-Windows” and paste it into “C:\Program Files\Docker\”.

Setting up the Docker Containers

To get a complete LEMP stack up and running with docker, you will have to create three containers, one for PHP-FPM, one for Nginx, and finally, one for MySQL. We have set up a docker-compose file that configures and sets this environment up. This was courtesy of Scott, our back-end lead. We should have an article on how you set that up in the future.

For now, I simply downloaded our repo with the docker-compose.yml file in there, navigated to that folder in Powershell and ran: “docker-compose up”.

You may come across a few issues here, and that will be around shared drives. Make sure you share the drive with your docker config files on. In my case, it was d: – therefore I opened up the Docker GUI from the taskbar by right-clicking on the icon and selecting “settings”, then went to “Shared Drives” and selected D. Finally press “Apply” to complete the change. Docker should update itself and restart, and you may be asked for your Windows credentials. Simply enter your password if a dialog appears.

At this point, assuming each container has come up properly, you should be able to visit your browser at http://localhost and see the “Welcome to nginx!” message.

If you do, we can continue; otherwise you will need to go back over the steps and make sure everything is correct, trying to debug any issues you come across. If you have questions, feel free to tweet them at @PushONLtd and I’ll try and help out if I can.

Additional to localhost, you should also be able hit and also see the nginx welcome message. If this IP doesn’t work, you may have a different one. To find out what you’re IP is, open up “Hyper-V Manager” in Windows, select the virtual machine called “MobyLinuxVM”, look to the bottom of the Hyper-V Manager window and you should see three tabs: 1) Summary, 2) Memory, and 3) Networking – click Networking. You should then see a column called “IP Addresses” and in here will be your IPv4 IP address, as well as your IPv6 IP address (wave to the future!)

Installing Magento 2

Clone Magento 2 from into a folder that is mapped to your docker container, and open a Cygwin terminal and navigate to that folder.

Run: composer install –prefer-source

Magento 2 should now start installing itself via composer. The prefer-source flag helps avoid some unwanted errors on Windows.

Once composer has finished running, hit your site in your browser and run through the browser installer. Hopefully you don’t come across any issues, and you should now have a Magento 2 site running on Docker within Windows.


It’s worth noting that Magento 2 is somewhat different to Magento 1. The way that you set it up is considerably more challenging, and requires a lot more steps than a Magneto 1 store. It may seem like a steep learning curve, but the benefits will be more than apparent once you’ve got this environment setup. It will not only help you towards your Magento 2 developments, but also older legacy projects will be able to take advantage of this workflow.