So, what’s up? If you’re a software developer or just starting out in this field, you’ve surely run into a really annoying situation. You spend hours writing code on your computer—everything runs perfectly fine—but when you deploy it to the server… nothing works!
This is the infamous and dreaded “it works on my machine” problem. It happens because the environment where you wrote the code is different from the environment where the system will actually run. Usually, you use Windows at home, but company servers run Linux.
In the past, the solution to this was to set up a “dual boot” (dividing the hard drive between Windows and Linux) or use very resource-intensive virtual machines. This slowed down the computer, caused it to freeze all the time, and consumed a lot of RAM. No one deserves to program with a PC that keeps freezing, right?
But the good news is that the game has changed. These days, there’s a magic combination that solves all of this in an elegant and lightweight way. I’m talking about the combination of WSL2, Docker, and VS Code. This trio has become the standard in the tech industry.
In this article, I’ll walk you through setting up your perfect local development environment. You’ll have the power of Linux running natively within your Windows system. Grab your coffee, get comfortable in your chair, and let’s get started!
What Is This Development Trinity?
Before we start installing programs, it’s very important that you understand what each of these tools does. Understanding the “why” behind things will make you a much better professional and better prepared to solve problems.
Don’t worry—I won’t be using any difficult technical terms here. Let’s simplify things so that everything makes sense to you. Think of these three tools as a team where each member has a very well-defined role.
WSL2: The Power of Linux Inside Windows
WSL stands for Windows Subsystem for Linux. Version 2 (WSL2) was a true revolution created by Microsoft. It allows you to run a complete, real Linux system—with its original “heart” (kernel)—right inside your Windows.
Do you know what this means in practice? You no longer need to restart your computer to switch operating systems. You open a simple black window in Windows, and—as if by magic—you’re typing commands in a real Linux environment.
This is wonderful because most programming tools, web servers, and databases were designed to work best on Linux. With WSL2, you combine business with pleasure: play your games and use Office on Windows, but program in a pure Linux environment.
Docker: Containers That Save Projects
Docker is, without a doubt, one of the most important tools of the decade. Remember the “it works on my machine” problem? Docker was created precisely to slay that monster once and for all. But how does it do that?
Imagine you want to ship your furniture to another country on a ship. If you just throw everything loose on the deck, you’ll run into trouble. So, you put everything inside a standard steel container. The ship doesn’t care what’s inside—it just knows how to transport that container.
Docker does the same thing with your code. It packages your project—along with all its configurations, libraries, and database versions—into a virtual “container.” That container will run exactly the same way on your computer, your colleague’s computer, or Google’s server. It’s total predictability!
VS Code: The editor that brings it all together
Visual Studio Code (or simply VS Code) is a favorite among programmers. It’s a code-focused text editor created by Microsoft that’s lightweight, fast, and fully customizable through extensions.
But its real magic for our scenario lies in an extension called “Remote Development.” It acts as an incredible bridge. The editor window stays open on your Windows machine, with its beautiful, user-friendly interface.
However, when you save the file or run the code, VS Code executes everything silently inside Linux (WSL2) or within a Docker container. It’s the best of both worlds working in perfect harmony!
Step-by-Step: Setting Up Your Environment from Scratch
Now that you know the theory, let’s get down to business. The process is much simpler than it seems. Take your time following the steps below, and in just a few minutes, your local development environment will be ready for any challenge.
1. How to Install and Enable WSL2
The first step is to prepare your Windows system to run Linux. Microsoft has made this process much easier in the latest updates to Windows 10 and Windows 11. All you need to do is use the command line.
Open the Start menu, type “PowerShell,” right-click, and select “Run as Administrator.” This is important because system commands require special permissions.
With the blue PowerShell window open, just type this command and press Enter: wsl --install. Yes, that’s all there is to it! Windows will download the necessary files, enable the virtual features, and install Ubuntu (the most popular version of Linux) by default.
When it finishes loading, it will ask you to restart your computer. Feel free to restart—the system is simply applying the settings to the Windows kernel.
2. Setting Up Your New Linux (Ubuntu)
After the computer restarts, a black terminal screen will open automatically, completing the installation. If it doesn’t open, go to the Start menu, search for “Ubuntu,” and click on it.
The system will ask you to create a username (UNIX username). You can enter your first name, all in lowercase letters and without spaces. Press Enter.
Next, it will ask for a password. Important note: when you type the password in Linux, nothing will appear on the screen—not even asterisks. This is normal; it’s a system security measure. Type your password carefully, press Enter, type it again to confirm, and you’re done! Your Linux is now running inside Windows.
3. Installing Docker Desktop and Connecting to WSL2
The next step is to install Docker on your machine. Go to Google, search for “Docker Desktop,” and download the official installer for Windows. It’s a free program.
Run the installer by clicking “Next” until the end. During installation, it will ask if you want to use the “WSL 2-based engine.” Make sure this option is checked! This ensures that Docker will use your new Linux environment to run containers extremely fast.
Once installed, open Docker Desktop. A whale icon will appear in the lower-right corner of your screen, near the clock. Go to Docker settings (gear icon), click “Resources,” then “WSL Integration,” and toggle the “Ubuntu” switch on. Now Docker and Linux are working hand in hand.
4. Connecting VS Code to the Linux World
If you don’t have VS Code yet, download it from the official website and install it as usual on your Windows machine. With VS Code open, we need to install the extension that makes the magic happen.
Click the “grid” icon in the left-hand sidebar (or press Ctrl+Shift+X) to open the extension store. Search for “WSL” (created by Microsoft) and click Install.
Now, open your Ubuntu terminal (remember it?). Navigate to the folder where you want to create your projects and type the following command: code . (the word “code,” a space, and a period). Press Enter.
VS Code will open on Windows, but notice the bottom-left corner of the screen: there will be a green banner that says “WSL: Ubuntu.” Congratulations! You’ve just opened your editor on Windows, but it’s accessing and running the files directly on the Linux kernel.
Golden Tips to Boost Your Productivity
Your local development environment is now up and running. But as an expert on the subject, I couldn’t resist sharing a few advanced tips I’ve learned over all these years of programming.
These small tweaks will make a difference in your day-to-day work, saving you headaches and making your computer much smarter when it comes to managing resources.
Watch Your RAM Usage
WSL2 is amazing, but it has a small “flaw”: if you don’t tell it otherwise, it may try to use almost all of your computer’s RAM to make Linux run very fast, which ends up causing Windows to freeze.
To fix this, you can create a limit file. Open Windows Notepad and create a file named .wslconfig (with a period at the very beginning). Save this file to your Windows user folder (e.g., C:\Users\YourName).
Inside this file, you’ll type two simple lines. The first is [wsl2]. The second is memory=4GB (or whatever limit you want to set; I recommend using no more than half of your total RAM). Restart your computer, and that’s it—WSL2 will never “steal” all your memory again!
Manage Extensions in the Right Place
When you use VS Code connected to WSL2, it divides your extensions into two parts: those that run in the Windows interface (such as themes and icon packs) and those that run on the Linux server (such as code formatters, tests, and error analysis).
Whenever you install a new programming extension (for example, a Python or Node.js extension), be sure to click the “Install in WSL: Ubuntu” button that appears on the screen. If you install it only on Windows, the extension won’t be able to read your code that’s inside the Linux environment!
Conclusion: Your new workflow is ready
We’ve reached the end of our journey! Just look at how far you’ve come. You’ve left behind old, slow systems, and now you have a professional local development environment—exactly like the one used by the world’s top developers.
Let’s quickly review what we’ve done: we installed WSL2 to run Linux quickly on Windows, configured Docker to run projects in an isolated and predictable manner, and connected it all through a user-friendly interface using VS Code.
With this setup, you can grab any project from the internet, run a Docker command, and watch the magic happen in seconds—without having to install programming languages or databases directly on your PC, keeping your machine clean and fast at all times.
So, were you able to set everything up just right on your computer? Did you have any questions about any of the steps, or did you run into any strange errors during installation? Tell us in the comments how your experience went! Our community is here to help each other and grow together. Warm regards and happy coding!