If you use Docker Desktop for Windows with WSL 2, you have probably noticed something quietly annoying: your C: drive slowly fills up, and there is no obvious setting to move Docker’s data somewhere else. On a typical Windows setup you would just change a data directory in the settings, but in Docker Desktop for Windows the WSL2 version, you don’t usually have options to increase memory and disk space, as those are managed directly by Windows.
The data lives inside a virtual disk managed by WSL, and to move it, we have to speak WSL’s language: export, unregister, and import. It sounds scarier than it is, and the whole dance takes about ten minutes.
The Docker Desktop data can be found originally in this location %USERPROFILE%\AppData\Local\Docker\wsl\data, and inside it sits a file called ext4.vhdx. That one file is your entire Docker world: every image, every container, every volume, all packed into a virtual hard disk.
🚚 Export Docker Data
In order to make this work, first shut down Docker Desktop. This can be done by right clicking the system tray icon of Docker, then from the context menu, Quit Docker Desktop. Let the process fully exit; a running Docker will happily corrupt the export.
Next is open your command prompt and type the following:
wsl --list -v
This command, when run, will return to you the state of all WSL images:
NAME STATE VERSION
* docker-desktop Stopped 2
docker-desktop-data Stopped 2
Note the exact name docker-desktop-data, since that is the distribution we are after. Make sure its state says Stopped before you continue.
After that we export the docker-desktop-data into a tar archive. We will assume you are planning to move the docker data into D: drive, and within the drive you have already created a folder named Docker:
wsl --export docker-desktop-data "D:\docker-desktop-data.tar"
The export can take a while if you have a lot of images, since the entire virtual disk is being packed into the archive. This is the one step where patience is required.
Next, is to unregister docker-desktop-data from WSL.
This command below will delete ext4.vhdx from %USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx, so make sure you back it up first:
wsl --unregister docker-desktop-data
There is no undo button here. If your export failed silently and you unregister anyway, your images are gone. Check that the tar file exists and has a realistic size before you run this.
🚛 Import Docker Data
After export, we do import docker-desktop-data back to WSL:
wsl --import docker-desktop-data "D:\Docker" "D:\docker-desktop-data.tar" --version 2
The ext4.vhdx will now reside in the D:\Docker folder, and your C: drive should breathe again. Start Docker Desktop and verify the changes: launch it, run docker ps, and check that your old containers and images show up exactly as you left them.
If everything works out, you can now delete the tar archive you created earlier, D:\docker-desktop-data.tar. Please don’t delete the ext4.vhdx, otherwise you will lose all your images and containers in docker.
In case the docker icon turns red in Docker Desktop, clear the docker cache which can be found in Docker Desktop settings.
🧠 Final Thoughts
Moving Docker’s data is one of those maintenance tasks that feels terrifying the first time and boring the fifth. The export, unregister, import dance is the official escape hatch when Windows decides your primary drive is not the place for a hundred gigabytes of images.
The golden rule, as always: verify the export before you unregister, and verify the import before you delete the tar. Do that, and you can keep Docker fat and happy on whatever drive you prefer. Thanks for reading!
