How to run multiple instances of the same distro in WSL?

Microsoft WSL is a very good technology when we want to run Linux applications on our Windows computer. When we install a distro from the Microsoft Store we can only install one instance of it. But with some work we can have multiple instances of the same distro.

If you would prefer to watch it in a video instead, here you are! Do not forget to subscribe!

WSL multiple distro instances

Step 1: export the distro from WSL

The following command will create a tar archive from the Debian WSL distro to the D:\home_lab\wsl_backups directory.

wsl --export Debian D:\home_lab\wsl_backups\Debian_export.tar

Step 2: import the exported distro

With the –import option we can import back the exported archive file. The new instance will be called Debian_imported and the system files will be in the D:\home_lab\wsl_backups directory. The archive that we want to import is the D:\home_lab\wsl_backups\Debian_export.tar.

wsl --import Debian_imported D:\home_lab\wsl_backups\ D:\home_lab\wsl_backups\Debian_export.tar

Now we have an additional Debian instance in our WSL. The exported tar file can be moved to an external disk as a backup as well.

Final thoughts

We can list our distros with the –list command (or -l short) followed by the –verbose option (or -v short).

wsl --list --verbose

When we don’t need a WSL distro instance anymore, we can delete them with the –unregister command.

wsl --unregister Debian_imported

For more information consult with the Microsoft documentation about the WSL technology:

https://learn.microsoft.com/en-us/windows/wsl/about

If you have anything to share then please visit my Tom’s IT Cafe Discord Server.

2 thoughts on “How to run multiple instances of the same distro in WSL?

  1. Hey, I did this. I exported one distro, unregistered it, and imported the same export to 3 different locations with 3 different distro names.

    when started, all had the same name, so I fixed that with /etc/wsl.conf
    Then realized that all have the same IP as well.

    Like

Leave a reply to tmolnar0831 Cancel reply