Blog Cover

How to be a productive programmer in Windows with WSL2

Aitor Alonso
Aitor Alonso

Jun 17, 2021

4 min read

Hi folks!

Today, I will explain to you how to configure WSL 2 on Windows to have a fully programming environment with productivity in mind. In this post, I will show you how to configure WSL 2 to fully integrate it with VS Code and Docker Desktop.

In case you missed it, in a previous post I explained how to install WSL2 on your Windows 10 machine.

Wait, can you really be a productive programmer in Windows?

Yes, or at least, WSL 2 will provide you with a Linux environment with all the fancy stuff such as a UNIX terminal (bash, zsh, ...), unix tools like curl, wget, ssh, ..., and everything you would need in a normal development environment, while still having a Windows OS where you can install some proprietary Windows-only apps.

This is how I configured my PC for my daily remote work as a professional programmer. Before that, I had a dual boot windows + Linux setup, which I encourage you to do if you want to enjoy the fully Linux experience. However, currently I prefer and easier approach, as I use a lot of apps that can only be installed on Windows along with some games with only Windows support, and I don't want to maintain two different OSes, nor having my disk space divided or a boot manager asking me what to boot.

First step: installing docker

To install docker on both Windows and WSL 2 you only need to install Docker Desktop with its .exe installer. That's it. Here is the official download URL:

Install it like any other Windows app. If it asks about enabling WSL2 support, just select it like in the picture below:

Installing Docker Desktop with WSL 2 support

Once installed, open the Docker Desktop app and go to settings by clicking on the gear icon on the upper bar (1). Then, check if effectively WSL 2 support is enabled (2). Also, there you can disable Docker Desktop to automatically start when you log in to Windows, or to send usage statistics if you want.

Checking WSL 2 support on Docker

If you have more than one Linux distribution installed on WSL 2, you may want to enable Docker for them as well. To do so, just go Resources > WSL integration as you see in the picture below.

Enabling WSL for individual distros

After that, maybe restarting Docker and WSL is required. You can just reboot your Windows PC, or manually:

  1. Right-clicking on the docker icon on task bar --> Restart Docker
  2. Open a PowerShell terminal and type wsl --shutdown

Testing and troubleshooting

You can test your Docker integration with WSL by running the following commands from WSL 2:

docker --version
docker-compose --version

If everything is correctly configured, those commands will show your docker installed version.

However, if it prints an error message saying that the docker or docker-compose command couldn't be found, check that the Docker Desktop app is up and running by looking for the Docker icon on the Windows task bar. If Docker is running and the error persists, you should double-check that you enable WSL2 integration on Docker Desktop settings, like in the pictures above. Try enabling it on all your Linux distros by activating the toggle button on Resources > WSL integration settings page or restarting your PC if you didn't do it already.

Next: installing VS Code Remote WSL extension

I suppose you already have installed the good knowing VS Code editor on your Windows. If you haven't done it yet, just download it from the official page and install it like any other Windows program. There is nothing especial with its installation process.

Then, open VS Code and install the Remote WSL extension. On the extension's page, you can read about what this extension does and how to use it.

Once the extension is installed and enabled, on VS Code press Ctrl + Shift + P and search for wsl commands. You should be able to see commands for opening a folder inside your WSL distro or just opening a new VS Code instance on your home directory, like in the next picture.

WSL commands from VS Code

If executing one of the above commands, you should be now using VS Code over a WSL folder. If you try to open the VS Code integrate terminal, you will load bash (or zhs or whatever your default distro shell is it) instead of PowerShell or CMD. You are, effectively, working inside your WSL environment.

Pro-tip: you can open a VS Code instance from/in a WSL directory by just typing on the WSL terminal:

code . 


Congratulations! Now you have a fully working dev environment with VS Code, fully integrated with Docker and with your favorite Linux shell and tools available. In fact, you are working on a near-to-full Linux distribution without leaving Windows, so Linux specific tools, configurations and project setups will work out of the box inside WSL.

With this setup, it is easy to feel productive programming on Windows!

(You can find comments to this article in