- Simplified WSL installation using PowerShell commands and Linux distribution management.
- Using the native wslc.exe tool to manage the container lifecycle without external software.
- Performance optimization through file location in the Linux file system and the use of WSL 2.
If you're a developer working in the Microsoft ecosystem, you know that coordinating the Linux and Windows worlds has long been a headache. Fortunately, the Windows Subsystem for Linux (WSL) has come to break down those barriers, but ¿how to install WSL Containers on Windows 11? That's what we're talking about in this post.
With the native WSL containers, We no longer depend strictly on external tools like Docker Desktop to run isolated applications, as Microsoft has integrated its own command-line tool to manage the container lifecycle in a much lighter and more direct way, leveraging the power of the Linux kernel in Windows 11.
How to set up WSL on your computer
To install WSL Containers on Windows 11, you need to make sure your system is up to date. If you have Windows 11 or a version of Windows 10 later than 2004 (build 19041), the process is very simple. You just need to open a window of PowerShell as administrator and launch the command wsl --installAfter restarting the computer, the system will enable everything necessary and install Ubuntu by default.
If Ubuntu doesn't suit you and you prefer another alternative, you can take a look at the available options with wsl.exe --list --onlineTo install a specific distribution, simply use the command wsl.exe --install -d Please note that the first time you boot Linux, the system will take a few moments to start up. unzip the filesBut subsequent times access will be virtually instantaneous.
It's essential that you set up your username and password as soon as you launch the distro. To optimize your experience, using [the appropriate tool/app/etc.] is highly recommended. Windows Terminalwhich allows you to manage multiple tabs and profiles, and the remote server of Visual Studio Code, which allows you to program in Windows while the code is actually running in the Linux environment.
Master WSL versions and distributions
Before installing WSL Containers on Windows 11, it's important to know that not all WSL installations are the same. Currently, WSL 2 It's the preferred option because it uses a lightweight virtualization architecture with a real Linux kernel, which significantly improves performance. You can check which version you're using with the command wsl.exe --list --verbose.
If for some reason you have a distro on WSL 1 and want to upgrade to version 2, you can run wsl.exe --set-version <Distro> 2If you prefer that all new installations be WSL 2 by default, the command is wsl.exe --set-default-version 2For those who need one offline installationThere are MSI packages available on GitHub that, together with enabling the Virtual Machine Platform through dism.exeThey allow you to set up the environment without internet.
As for access, you have several options: from the start menu by typing the name of the distro, or launching it from PowerShell by simply typing ubuntu, or by integrating it into the Windows file explorer by accessing the path \wsl.localhost for manage Linux files with the convenience of the Windows graphical interface.
Install WSL Containers on Windows 11 with wslc.exe
This is where the real gem comes into play: wslc.exeThis tool is essentially the container CLI integrated into WSL, allowing you to compile and run applications without installing heavy third-party engines. To use it, you need WSL version 2.9.3 or higher, which you can obtain by running wsl --update --pre-release.
To check that everything is in order, simply write wslc version and then try a fast container with wslc run --rm hello-worldThe syntax of wslc is very similar to that of Docker, making the learning curve almost nonexistent. For example, you can launch an Nginx server in the background by publishing port 8080 with the command wslc run -d --rm -p 8080:80 --name web nginx and then access from your browser to localhost:8080.
If you want to create your own image, all you need is a Containerfile in the root of your project. For example, for a Django app, you would define the base Python image, copy the requirements, and run the server. Then, you use wslc build -t nombre-imagen . to build it and wslc run to get it up and running. It's an incredibly smooth workflow that integrates seamlessly with VS Code.
Optimization and problem solving
A very common mistake is noticing that performance is slow. The master trick here is store the project files within the Linux file system (for example, in /home/usuario) and not in Windows folders (like /mnt/c/The difference in disk access speed is enormous and is key to making containers fly, although you might notice that the process vmmem in Windows 11 consumes a lot of memory resources.
If you encounter error 0x80004005, it is most likely that the service LxssManager It's not starting automatically; check your Windows services settings. Also, if you're having trouble downloading updates on distributions like Kali Linux, try changing the repositories from HTTP to HTTPS in the configuration file. sources.list and verify that the DNS server is correctly configured.
To keep your equipment clean, remember that images and containers taken up space. You can do a general cleaning using wslc container prune to delete the stopped containers and wslc image prune to eliminate the images you no longer use, thus freeing up storage on your ext4 virtual hard drive.
The ability to integrate a real Linux kernel using WSL 2 has transformed Windows 11 into an extremely versatile platform for cloud-native development. From simplified one-command installation to native container management with wslc, it's now possible to bypass the cumbersome traditional virtualization layer and work with tools like CUDA, PyTorch or TensorFlow Thanks to GPU support, achieving an environment where compatibility and power meet in one place.
Editor specialized in technology and internet issues with more than ten years of experience in different digital media. I have worked as an editor and content creator for e-commerce, communication, online marketing and advertising companies. I have also written on economics, finance and other sectors websites. My work is also my passion. Now, through my articles in Tecnobits, I try to explore all the news and new opportunities that the world of technology offers us every day to improve our lives.