DEV Community

Kim CH
Kim CH

Posted on

85 6 1

Move docker-desktop-data distro out of System Drive

By default, Docker Desktop for Window will create 2 distros below

  • docker-desktop
  • docker-desktop-data

If we access the path %LOCALAPPDATA%/Docker/wsl; we can see 2 folders; and inside it is vhdx file. For detail,

  • data/ext4.vhdx which is consumed by docker-desktop-data
  • distro/ext4.vhdx which is consumed by docker-desktop

In which, docker-desktop-data is used to store images and so on. Therefore, its size will be increased in the future, consequently, our System Drive will be out of space. Below are step-by-step to move docker-desktop-data out of System Drive, for example, E:\docker-desktop\data.

Step 1: Stop Docker

Step 2: Export, unregister then import distro

1- Shutdown all WSL distros

wsl --shutdown
Enter fullscreen mode Exit fullscreen mode

2- Export docker-desktop-data to tar file

wsl --export docker-desktop-data E:\docker-desktop\docker-desktop-data.tar
Enter fullscreen mode Exit fullscreen mode

3- Unregister current docker-desktop-data distro

wsl --unregister docker-desktop-data
Enter fullscreen mode Exit fullscreen mode

4- Import docker-desktop-data distro from tar file

wsl --import docker-desktop-data E:\docker-desktop\data E:\docker-desktop\docker-desktop-data.tar --version 2
Enter fullscreen mode Exit fullscreen mode

Notes:

  • In this step, we may meet the error of cannot create a specific network. Just re-run the import command.

Step 3: Start Docker

Resources

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • --last-failed: Zero in on just the tests that failed in your previous run
  • --only-changed: Test only the spec files you've modified in git
  • --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Practical examples included!

Watch Video 📹️

Top comments (17)

Collapse
 
brianhvb profile image
Brian Houle • Edited

This seemed to move %LOCALAPPDATA%\Docker\wsl\data\ext4.vhdx, but left %LOCALAPPDATA%\Docker\wsl\distro\ext4.vhdx in place, which is currently in use by Docker Desktop.

Is there a way to export/move this to a different drive as well?

Collapse
 
cesarchamal profile image
Cesar Chavez

You can do the same thing but change for docker-desktop

wsl -l -v
wsl --shutdown docker-desktop
wsl --export docker-desktop E:\docker-desktop\docker-desktop.tar
wsl --unregister docker-desktop
wsl --import docker-desktop E:\docker-desktop\distro E:\docker-desktop\docker-desktop.tar --version 2

Collapse
 
jotcomponents profile image
Jotcomponents

Thanks very much for the procedure. It is working on Win11 WSL2. But before 'Step3: Start Docker' it was necessary to restart Win (as it is also recommended in 'Resource#2 Moving Docker wsl files').
Remark: Resource#1 link is no more valid.

Collapse
 
copdips profile image
Xiang ZHU

Thanks for sharing.
Just a tip: the Docker Desktop WSL distro should be small, so there's no need to move it.
It's the Docker data VHD file that is large — this file contains the Docker images.
In newer versions of Docker Desktop, there's a built-in feature in the GUI to move this data VHD file to another drive.

Collapse
 
alexvovk profile image
Alex

Very helpful! Thank you!

Collapse
 
lorenzo_sandini profile image
Lorenzo Sandini

I am joining the choir singing your praise ! Thanks a bunch :)

Collapse
 
minhlong profile image
Timmy

Thank you so much, it helped me so much.

Collapse
 
khashashin profile image

After I moved the docker-desktop-data (ext4.vhdx) All my folders under /mnt folder was empty.

Collapse
 
bernardbr profile image
Bernardo Esbérard

Thanks man! You've helped me a lot... :D

Collapse
 
mustafakurkcu profile image
Mustafa Kürkcü

Thank you

Collapse
 
arvindd profile image
Arvind Devarajan

Hey, thank you for this! Good hint :-)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay