Introduction
All right, so you’re a developer working on a Windows machine, and as such, you’ve probably come across the topic of setting up a local dev environment before. Maybe you just needed a local Apache server and went for a standard XAMPP-setup. Or maybe – due to the ever-increasing complexity of your projects – you eventually stepped things up to using a bunch of VMs with different setups and configurations, which kind of works, yet always left you wondering if there isn’t a better way of doing this. A swifter way, both easier to set up and manage, as well as less resource and time-consuming on the performance side of things.
Docker & DDEV for the rescue!
Well, guess what? There actually is, and it’s using Docker containers instead of VMs, while using DDEV-Local as a tool to easily manage these containers without even having to learn much about them (except that they’re awesome, and that you should start using them ;D).
The result: A flexible, easy to maintain dev environment that’ll allow you to spend less time on configurations and upkeep, and more time on putting out actual code – with the addition of being a whole lot faster to work with than any VM-based setup.
For more information on Docker containers, DDEV-Local or why they’re so awesome, please see:
https://ddev.com/ddev-local/docker-containers-vs-vms-for-quick-consistent-local-dev/
https://ddev.com/ddev-local/why-use-ddev-local-instead-of-rolling-your-own-docker-based-localdev-solution/
But what about WSL2? What’s up with that?
WSL stands for “Windows Subsystem for Linux”, and in its version 2 (generally available as part of
Windows 10 since May 2020), it’s basically a full-powered implementation of Linux inside of
Windows. In other words: It’ll allow us to run a Linux distribution right inside of Windows 10, which in turn will be handling all the Docker and DDEV-jazz for us (while also giving us a nice boost in terms of filesystem performance).
For more information on WSL2, please see:
https://docs.microsoft.com/en-us/windows/wsl/about
The bottom line
Once we got our new dev environment set up and running, chances are you’re going to fall in love with it, immediately. So without any further ado – let’s get started!
Getting started
Important:
If you’re installing this for a non-admin Windows user, there are a few extra-steps you will have to take – highlighted in grey just like this notice. If the Windows user you’re installing this for is an admin, please just ignore these.
1. Installing Chocolatey package manager
In order to install mkcert and Docker Desktop, we’re first going to need the Chocolatey package manager for Windows. To install it, open an administrative PowerShell window (search for PowerShell, then right-click and “Run as administrator”) and run the following command:
Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol =
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((NewObject
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
2. Creating a local CA (using mkcert)
Next, we’re going to create a local self-signed SSH certificate using mkcert. To do so, we’re first going to install mkcert by running the following command, again in administrative PowerShell:
choco install -y mkcert
Close your PowerShell window and open up another one – but this time without selecting “Run as administrator” (=regular PowerShell).
Then, in order to create the certificate, go ahead and run the following command:
mkcert -install
Once you agreed to the prompt, this generates a local CA inside your Windows user folder.
(the full path being C:\Users\<YourUser>\AppData\Local\mkcert)
After that, we’re going to tell WSL to use our newly created CA. To do so, just run the following command, again in regular PowerShell:
setx CAROOT "$(mkcert -CAROOT)"; If ($Env:WSLENV -notlike "*CAROOT/up:*") {
setx WSLENV "CAROOT/up:$Env:WSLENV" }
3. Installing WSL2 and Ubuntu
Please note:
When installing WSL2 like I’m about to show you, Ubuntu will be installed as the default Linux distribution, which is why I’ll almost exclusively be referring to “Ubuntu” for the rest of this tutorial. If you’d like to install a different Linux distribution, I’d recommend following this guide on manually installing WSL.
With our local CA set up, we’re ready to install WSL2 and Ubuntu. To do so, go ahead and close your PowerShell window again, then open up another administrative one and run:
wsl –-install
Once WSL2 has been installed, you’ll have to restart your Windows system in order to proceed with
the installation of Ubuntu.
For non-admin users:
If you’re installing this for a non-admin Windows user, you’ll have to login as admin after the restart, or else the installation won’t continue.
Then, once Ubuntu has finished installing and while still being logged-in as admin, go ahead and open the Windows panel “Programs and Features” and look for the Ubuntu app to uninstall it again.
Log out as admin and back in as your non-admin “standard” user.
Open the Microsoft Store app and search for Ubuntu, then download and install the Ubuntu app (the one without a version number).
Please note: I know this is kind of a clunky approach, but I found it’s the most easy-to-follow way of doing this. If you’d prefer a more elegant solution (or maybe would like to install a different Linux distribution after all), please follow this manual installation guide, but make sure to install your Ubuntu/Linux distro as a “standard” user.
Once Ubuntu has been installed, you can open up the Ubuntu terminal (if it hasn’t already) and run the following commands to bring Ubuntu up-to-date:
sudo apt-get update
sudo apt-get upgrade
4. Installing Docker Desktop for Windows
As the final piece of the puzzle, we’re now going to install Docker Desktop for Windows. To do so, open up administrative PowerShell and run:
choco install docker-desktop
Once installation has finished, do not restart Windows right away, but instead seach for and start the Windows panel “Computer Management” via “Run as administrator”.
Go to “Local users and groups”, then open “groups” and double-click on the group “docker-users” (at the end of the list).
Add your own user to the “docker-users” group and restart Windows.
For a more thorough guide on adding the docker-user, please see:
https://docs.microsoft.com/en-us/windows/wsl/about
Once Windows has restarted, you should be able to open Docker Desktop and double-check its settings to make sure both WSL2 and WSL Integration are enabled:


5. Confirming it works
Lastly, to confirm it all works, go ahead an run the following command in regular PowerShell (while having both Ubuntu and Docker Desktop running):
wsl -l -v
Now, if you installed this for/as an admin-user, you should find that there currently are three
distributions installed (with Ubuntu being the default one marked by an *), and that all three of
them are using WSL version 2;

For non-admin users:
However, if you installed this for a non-admin Windows user, you’re probably going to find that – at the moment – Ubuntu is running on WSL version 1:
In this case, just run the following command in regular PowerShell:wsl --set-version Ubuntu 2
To confirm it works, run:wsl -l -v
Should be looking fine now:
After this, we’re going to confirm the local CA (stored inside our Windows user folder) is being found by Ubuntu. To do so, run the following command inside the Ubuntu terminal:
echo $CAROOT
If it works, this should return something along the lines of:
/mnt/c/Users/<YourUser>/AppData/Local/mkcert
Please note: Since this is the path Ubuntu uses to access your user folder in Windows, <YourUser> will be correspondent to your Windows user name (not the Ubuntu one).
Lastly, we’re going to check that Docker Desktop is working and accessible from within Ubuntu. To do so, run the following command (again, in Ubuntu terminal):
docker ps
If it works, you should see something like this:

And there you have it! Your local dev environment set up and ready for creating your first DDEV
project, which is what I’m going to show you in Part II of this tutorial series.
For now, however, I hope you found this one to be helpful, and if you have any questions, feedback or suggestions regarding it, please feel free to leave a comment below!
One thought on “A local dev environment for Windows 10 – Part I: Installing Docker, DDEV-Local & WSL2”