How to Move WSL Distributions and Docker Images to Another Drive on Windows
Learn how to move WSL distributions and Docker images to a different drive on Windows to free up space, improve performance, and optimize storage. Step-by-step guide with terminal commands and tips.
Running out of space on your Windows system drive? Or maybe you're optimizing performance and prefer to isolate your Linux environment. By default, Windows installs WSL (Windows Subsystem for Linux) distributions and Docker images on the C: drive, which can quickly fill up. The good news is that you can move them to a different location — safely and without losing any data or configuration.
This guide walks you through the entire process of relocating WSL distributions and Docker data to another drive, using built-in commands. Whether you're moving Ubuntu, Alpine, or the docker-desktop distributions, these steps apply to all.
Check Which WSL Distributions Are Installed
Before you move anything, you need to identify the distributions currently installed on your system.
Open a terminal and run:
wsl --list --verboseor the shorthand version:
wsl -l -vThis will return a list of installed distributions and their states:
NAME STATE VERSION
* Ubuntu-22.04 Running 2
docker-desktop Running 2
docker-desktop-data Running 2docker-desktop and docker-desktop-data listed. These can also be relocated using the steps below.Export WSL Distribution Data
Once you've identified the distribution you want to move, you'll export its filesystem to a .tar archive.
Run this command:
wsl --export <distro_name> <distro_name>.tarFor example, to export the Docker Desktop data:
wsl --export docker-desktop docker-desktop.tarThis will create a .tar file in your current directory containing the full file system of the selected distribution.
Unregister the Existing Distribution
After exporting, the next step is to unregister (delete) the current instance of the distribution from WSL.
This command will remove it:
wsl --unregister <distro_name>Using our earlier example:
wsl --unregister docker-desktopRe-import the Distribution to a New Location
Now you're ready to import the exported data to a different location, such as another drive (e.g., D:\WSL\).
Use the --import command:
wsl --import <distro_name> <install_location> <backup_file.tar> --version 2Example:
wsl --import docker-desktop D:\WSL\docker-desktop docker-desktop.tar --version 2This recreates the distribution from the .tar backup in the specified directory. You can choose any location, but ensure it's on a drive with enough space and that the destination folder exists (create it if needed).
/d/WSL/docker-desktop.Verify and Run Your Distribution
Once imported, your distribution is available again via WSL.
You can verify its status with:
wsl -l -vIt should show up in the list, just like before, now running from the new location.
To launch it:
wsl -d <distro_name>Why Move WSL and Docker Distributions?
There are several good reasons to relocate your WSL environments:
- Free up space on the
C:drive, especially useful on SSDs with limited capacity. - Improve performance by using a faster or dedicated drive.
- Better organization of development environments, especially in enterprise or devops workflows.
- Security and backup: easier to isolate and back up Linux environments stored on a separate volume.
Conclusion
Relocating your WSL distributions and Docker data to another drive is a smart way to manage storage, speed up your system, and maintain better control over your development environments.
With just a few terminal commands — exporting, unregistering, and importing — you can move your Linux containers without losing a single file or configuration. It’s a low-risk operation with high rewards.
If you're using WSL as part of a Docker development setup, or managing multiple Linux environments on Windows, moving them off the main drive can make a noticeable difference in performance and organization. Give it a try and reclaim your space!