Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving Docker wsl files #5829

Open
plleg opened this issue Feb 20, 2020 · 25 comments
Open

Moving Docker wsl files #5829

plleg opened this issue Feb 20, 2020 · 25 comments

Comments

@plleg
Copy link

plleg commented Feb 20, 2020

  • [x ] I have tried with the latest version of my channel (Stable or Edge)
  • [ x] I have uploaded Diagnostics
  • Diagnostics ID: 2F4E65B5-BC26-4EAB-94A4-E8AFD65D5F42/20200220172638

Expected behavior

docker starts

Actual behavior

docker does not start

Information

  • Windows Version: Windows 10 Pro insider preview 10.0.19564
  • Docker Desktop Version: 2.2.1.0 (42746)
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: no

Due to space limitations, I am trying to move files in %APPDATA%\Local\Docker to another drive. Finding up-to-date information on how to do this is bewildering. So I tried adding "data-root": "D:\docker" to the config section of Settings > Docker Engine.

Steps to reproduce the behavior

@haimat
Copy link

haimat commented Apr 7, 2020

I have exactly the same problem.
Any news on this?

@thijsputman
Copy link

It's probably a matter of moving the two WSL2 distros created by Docker Desktop (output of wsl -l -v on my system):

image

Using these instructions (or similar): microsoft/WSL#4320 (comment)

wsl --export docker-desktop docker-desktop.tar
wsl --unregister docker-desktop
wsl --import docker-desktop X:\wslStore\ docker-desktop.tar --version 2

⚠ I haven't tried these instructions myself, so be very careful. There's good chance they'll destroy your Docker Desktop installation...

I'm just looking around to see if anyone has already figured out if and how this can be done (as I'm expecting to encounter disk-space issues at some point in the future).

@haimat
Copy link

haimat commented May 1, 2020

@thijsputman Thanks for this feedback. I managed to do exactly what you suggested, and that worked fine for me. When I first started Docker after moving those two WSL distros it gave me some errors. But after restarting my whole machine and starting Docker again it works fine now, even with the moved WSL distros.

@thijsputman
Copy link

@haimat, thanks for the confirmation; it indeed appears to work just fine 🙂

Issued a wsl --shutdown before the export/import; didn't get any errors when starting Docker aftewards. Now fingers crossed that it survives an update of Docker Desktop application...

@tfossoul
Copy link

It's probably a matter of moving the two WSL2 distros created by Docker Desktop (output of wsl -l -v on my system):

image

Using these instructions (or similar): microsoft/WSL#4320 (comment)

wsl --export docker-desktop docker-desktop.tar
wsl --unregister docker-desktop
wsl --import docker-desktop X:\wslStore\ docker-desktop.tar --version 2

⚠ I haven't tried these instructions myself, so be very careful. There's good chance they'll destroy your Docker Desktop installation...

I'm just looking around to see if anyone has already figured out if and how this can be done (as I'm expecting to encounter disk-space issues at some point in the future).

This is working for me but then my ubuntu 18.04 start as root user instead of my personnal user.
Found the solution here: microsoft/WSL#4276 (comment)

@thijsputman
Copy link

Now fingers crossed that it survives an update of Docker Desktop application...

A small addition: It's sufficient to move the docker-desktop-data WSL-distro. The other one (docker-dekstop) gets restored to its original location when you update Docker Desktop – it's small and doesn't grow in size when using Docker.

@garbinmarcelo
Copy link

any news?

@darthdeus
Copy link

Just linking the other relevant issue that was auto-closed a few days ago #3122 ... same problem, can confirm still happening for me as well.

@Erokos
Copy link

Erokos commented Sep 25, 2020

Hi @thijsputman I'm interested to know if the setup survived an update? I've successfully used this thread to set up my WSL2 distro and Docker on a different drive but am afraid to update Docker now :D

@thijsputman
Copy link

Hey @Erokos, it survives updates of Docker Desktop just fine!

The only thing that happens is that the (small) docker-desktop container gets restored to its original location (if you even bothered to move that one in the first place).

@rdettai
Copy link

rdettai commented Dec 16, 2020

it worked perfectly for me across multiple updates, but just stopped working... it maybe has something to do with 3.0.0 ?

@thijsputman
Copy link

it worked perfectly for me across multiple updates, but just stopped working... it maybe has something to do with 3.0.0 ?

Just updated to 3.0.0 and on my system it's still working as expected (with docker-desktop-data still in its non-default location).

@al-yakubovich
Copy link

al-yakubovich commented Jan 30, 2021

After I did:

wsl --export docker-desktop docker-desktop.tar
wsl --unregister docker-desktop
wsl --import docker-desktop X:\wslStore\ docker-desktop.tar --version 2

docker-compose up stopped working.

I was getting the following error:
ERROR: Cannot start container: failed to update store for object type ....

I solved this issue after I've restarted docker TWICE.

@mloskot
Copy link

mloskot commented Mar 29, 2021

@al-yakubovich From the commands you listed, you forgot to run wsl --shutdown first, then follow with the other three.

See https://dev.to/kimcuonthenet/move-docker-desktop-data-distro-out-of-system-drive-4cg2

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@hchokshi
Copy link

hchokshi commented Jul 1, 2021

/remove-lifecycle stale

This would be very useful when running the system off a smaller drive and having a larger data drive (e.g. NVMe system drive, larger SSD/HDD for data).

@gabrielsoldani
Copy link

It'd be nice if this was officially supported, or at least officially documented.

The GUI says under Resources that "You are using the WSL 2 backend, so resource limits are managed by Windows." It seems like, at least for docker-desktop-data, the resources' location is also abstracted away from Docker and managed by Windows, but as the message says only about limits, this is not part of the contract.

@IsisChameleon
Copy link

Hey, thanks for saving my clogged C: drive!
I tried the whole procedure with Docker version 20.10.8, build 3967b7d, wsl 2 ubuntu 20.04 Kernel version 5.4.72 on Windows 10 Pro and it worked like a charm.

(1) list WSL stores: wsl -l -v

They should be stopped after stopping docker desktop
(2) wsl --shutdown

(3) wsl --export docker-desktop-data docker-desktop.tar
wsl --unregister docker-desktop-data
wsl --import docker-desktop-data G:\WslStore\ docker-desktop-data.tar --version 2

(4) restart computer (just in case) ... docker desktop started without a glitch and my container is up and running with my named volume as before etc...

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@ytilotti
Copy link

ytilotti commented Nov 23, 2021

Hi all, thanks for your answer. @IsisChameleon there is a little typo error on your command. I make this process in my side:

wsl -l -v
wsl --shutdown
wsl --export docker-desktop-data G:\Docker\WslStore\docker-desktop-data.tar
wsl --unregister docker-desktop-data
wsl --import docker-desktop-data G:\Docker\WslStore\ G:\Docker\WslStore\docker-desktop-data.tar --version 2

## Restart the computer, up Docker and tests
rm G:\Docker\WslStore\docker-desktop-data.tar

@mg-christian-axelsson
Copy link

/remove-lifecycle stale

Even if this won't be supported by official tooling it should at least be documented in the official documentation.

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@mg-christian-axelsson
Copy link

/lifecycle frozen

@edisoncpp
Copy link

edisoncpp commented Aug 27, 2023

After some ASP.NET Core compose of containers started filling up my development computer quickly, I stood up a 3 TB NAS server sharing with SMB. I mapped a drive (N) to a new NAS share and after doing the shutdown, and export ran the following:

wsl --import docker-desktop-data "N:\data" "N:\data\docker-desktop-data.tar"

causes:
This security ID may not be assigned as the owner of this object.
Error code: Wsl/Service/0x8007051b

I've tried looking at various permissions, but can't seem to get it to accept the new location, it creates an empty ext4.vhdx and stops. This puts me dead in the water as the files are too large for my development laptop that otherwise would have 12 Gb free.

Any ideas on the work around?

Thanks!

@2020-abhilash
Copy link

Seems like the movement of the disk to another drive didn't survive a Docker Desktop upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests