DEV Community

loading...

Move docker-desktop-data distro out of System Drive

Kim CH
Father, Husband and Developer
・2 min read

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

2- Export docker-desktop-data to tar file

wsl --export docker-desktop-data E:\docker-desktop\docker-desktop-data.tar

3- Unregister current docker-desktop-data distro

wsl --unregister docker-desktop-data

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

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

Discussion (8)

Collapse
arvindd profile image
Arvind Devarajan

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

Collapse
sd2020bs profile image
sd2020bs

thank you, man!

Collapse
willemodendaal profile image
Willem Odendaal

My C drive thanks you!

Collapse
jeyaramj profile image
Jeyaram Jeyarajah

Thanks a lot. This helped me a lot. I was so close to partitioning my pc to use more space in C :D and found this page..

Collapse
minhlong profile image
Timmy

Thank you so much, it helped me so much.

Collapse
khashashin profile image
Yusuf Khasbulatov • Edited

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
alexvovk profile image
Alex

Very helpful! Thank you!