Installing Debian Trixie in WSL Using Docker

Posted on January 16, 2026

Windows Subsystem for Linux (WSL) provides an excellent way to run Linux distributions on Windows, but it has a limitation: you can only install one instance of each distribution from the Microsoft Store. If you’re already running a WSL distribution and want a fresh, separate Debian environment — perhaps for testing the upcoming Trixie release — you’ll need a workaround. The solution is to use Docker to export a clean Debian rootfs and import it as a new WSL instance.

Why This Approach?

While you could clone your existing distro with wsl --export and --import, that gives you a copy rather than a fresh start. The Docker method provides a minimal, clean Debian installation that’s completely independent of your existing setup.

Prerequisites

Before you begin, ensure you have the following:

  • Windows 10/11 with WSL2 enabled
  • Docker Desktop installed and running

Creating the Rootfs Using Docker

Open PowerShell and run the following commands to create a minimal Debian Trixie filesystem:

docker run --name debian-temp debian:trixie true
docker export debian-temp -o debian-trixie.tar
docker rm debian-temp

This creates a container from the official Debian Trixie image, exports its filesystem to a tar file, and cleans up the temporary container.

Importing into WSL

Now import the tar file as a new WSL distribution:

wsl --import Trixie C:\WSL\Trixie debian-trixie.tar

The second argument is where WSL will store the virtual disk for this distribution. Choose a location that makes sense for your setup — C:\WSL\ keeps things organised, but you could use any path.

Test that it works:

wsl -d Trixie

You should be dropped into a root shell.

Creating a User Account

The imported image only has a root user. To create a regular user account:

  1. Update the package lists and install sudo:

    apt update && apt upgrade -y
    apt install sudo
    
  2. Create a new user with sudo privileges:

    useradd -m -G sudo -s /bin/bash yourusername
    passwd yourusername
    

Replace yourusername with your preferred username.

Setting the Default User

Exit the WSL session and run this from PowerShell:

wsl --manage Trixie --set-default-user yourusername

Now when you start Trixie, you’ll log in as your user rather than root.

Fixing Locale Warnings

The minimal Docker image doesn’t include generated locales, so you’ll likely see warnings like:

bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8)

Fix this by installing and configuring locales:

sudo apt install locales
sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen
sudo locale-gen

Restart the distro for the changes to take effect:

wsl --terminate Trixie
wsl -d Trixie

Enabling Docker Desktop Integration (Optional)

If you want to use Docker commands inside your new Trixie instance without installing Docker separately:

  1. Open Docker Desktop
  2. Go to SettingsResourcesWSL Integration
  3. Enable the toggle for Trixie
  4. Click Apply & Restart

The docker command will now be available inside Trixie.

Managing Your New Instance

Here are some useful commands for working with your new distribution:

# List all distributions
wsl --list --verbose

# Start Trixie
wsl -d Trixie

# Shut down Trixie
wsl --terminate Trixie

# Remove Trixie completely
wsl --unregister Trixie

Conclusion

This method gives you a clean, minimal Debian Trixie installation running alongside your existing WSL distributions. It’s perfect for testing the upcoming Debian release, isolating development environments, or simply having a fresh playground without affecting your main setup.

The same technique works for any Debian release — just change debian:trixie to debian:bookworm, debian:sid, or whichever version you need.

devops linux sysadmin wsl