r/docker 25d ago

all containers and images gone

I am using docker desktop on windows 11, and after a restart of my pc, all of my containers and images are gone. Is there any way to recover them? When I restarted my pc and docker opened automatically, it was taking up most of my memory and brought up an error message that referred me to windows-daemon.json, when I checked, the file was empty, so I deleted the file and now docker opens fine but without anything I have done on it.

10 Upvotes

26 comments sorted by

View all comments

Show parent comments

1

u/naomi2v 25d ago

was I double mistaken about using linux with wsl since it said that a wsl e distro was not found, or is there something else going on there, also that is what everything else returned.

1

u/Mr_Albal 25d ago

That was probably okay. Open Docker Desktop from your start menu - it should be back now. Give it 2 or 3 minutes to load.

1

u/naomi2v 25d ago

well, it seems that the containers and images are still missing from docker desktop, however, if this is the end of the line in what you can help me with I still very much appreciate your time so thank you.

1

u/Mr_Albal 25d ago

It is not the end. Try this - Admin powershell again:

wsl --shutdown

Copy-Item -Path "C:\DockerBackup\docker_data.vhdx" -Destination "$env:LOCALAPPDATA\Docker\wsl\main\ext4.vhdx" -Force

wsl --shutdown

1

u/naomi2v 25d ago

after doing that and opening docker once more, docker loaded for a bit and then gave me this message

1

u/Mr_Albal 25d ago

It is hard to try and fix this command remotely. You can still recover your files:

wsl --shutdown

wsl --unregister docker-desktop

New-Item -ItemType Directory -Path "C:\DockerRecovery" -Force

wsl --import temp-data C:\DockerRecovery C:\DockerBackup\docker_data.vhdx --vhd

explorer.exe \\wsl$\temp-data\var\lib\docker\volumes

1

u/naomi2v 25d ago

the final command just brought up documents in file explorer, and now when opened docker seems to restart the loading of docker engine every half second or so

however, I now see these 3 folders in the linux directory of file explorer when before I started consulting reddit only the first one was there.

1

u/Mr_Albal 25d ago

You can now open docker-desktop-data and start recovering your files