Since my recently published blog post When Docker meets Make, a few of my mates commented they couldn’t get Docker and GNU Make working on their shiny new Windows PCs. Being a non Windows user, I didn’t have a definitive answer, but suggested trying the Ubuntu app (the one that comes as a ‘Linux Subsystem’ on Windows 10).
It turns out that, whilst it’s cool, this just added another set of challenges in terms of getting Docker working.
So away I went on a learning journey, resulting in this step-by-step guide to help get your favorite tools working on Windows without needing to use Ubuntu Emulator.
A FEW CONSIDERATIONS
Docker on Windows uses Hyper-V, which might be sad news to people who like to use VirtualBox. Unfortunately, you cannot use both virtualization platforms on same operating system. Therefore be aware once you activate Hyper-V, your VirtualBox will no longer run 64bit VMs.
GNU Make is primarily a Linux based tool which is now ported to Windows. So while it will still work, you might notice some inconsistencies.
In order to perform tasks mentioned below, you must have Administrator level access to your Windows box.
LET’S GO!
If you have a modern computer you don’t need to worry about this, because VTX Virtualization support should come default with modern processors. However, it’s important to ensure that this feature is enabled in your computer’s BIOS settings which will allow you to enable Hyper-V support on Windows.
How to check BIOS settings? Well, this is different for each computer manufacturer. Usually, pressing a ‘Delete/Del’ key on keyboard at boot time should take you to BIOS configuration.
Once your system comes back up, find an option called ‘Turn Windows Features on or off’ in Control Panel. This should open a window with any extra features provided by Windows. Click the checkbox before ‘Hyper-V’, save the settings and reboot the PC.
(2) INSTALL PACKAGE MANAGER ON WINDOWS
Just like apt-get
in Ubuntu, yum
for CentOS, and homebrew
for Mac; there is a package manager called Chocolatey
for Windows. Chocolatey makes it easy to install 3rd party tools on Windows just like installing PowerShell modules from PowerShell Gallery.
You can install Chocolatey in one (actually two) simple steps 😃
Start PowerShell as an Administrator
Run the command below
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
More installation options can be found here.
Also, whilst not specifically required, in my experience it’s good to reboot your PC after this step.
(3) INSTALL DOCKER AND MAKE
Now that we have our Chocolatey package managed, installed and ready to use, we can now run choco
command in PowerShell to install any 3rd party tools from Chocolatey Packages repository. I would highly recommend removing any pre-installed version of Docker from your PC before proceeding with this step.
- Start PowerShell as an Administrator
- Run
choco install docker-for-windows
(follow the prompts, if any). - Run
choco install make
(follow the prompts, if any). - Reboot your PC.
Ta-da! Now you have the Linux goodness, even in Windows.