Docker For Windows deleted all my data after copying appdata/local from one user to another

I copied the folder AppData\Local\Docker from one user’s directory to another. I was able to see all of the containers, images, volumes from the previous user. However, after restarting Docker none of the containers, images, volumes appear. Did Docker delete or rebuild the AppData\Local\Docker folder? Is my data gone?

Do you mean you could see the images and containers when you started Docker the first time as the new user and it disappeared when you restarted Docker?

I don’t know the asnwer, but I would not copy data like this. Exporting data and then importing in an other environment is what would probably work. I don’t see why Docker Desktop would delete anything after it successfuly used that. If you could never see the images as the new user, then your data might be there, but it can’t use that.

Did you delete the data already from the old location?

Yes, all images, containers, volumes, etc were present after pasting the old user’s folder into the new user’s AppData\Local\Docker. The last container I had created was from a compose.yml I downloaded off the Internet and I could see the volume it created so I’m fairly certain all of my was available before the restart that deleted everything.

I looked at the docs for how to back up/restore and they seemed 1) overly complex for what I was trying to do (migrate my data from one user to another on the same computer) 2) unnecessary because after the folder was moved over, I started Docker and everything was working as intended.

Unfortunately I did not copy and paste but cut and paste; it would be disappointing if this one detail was the reason why my data was gone. What are the circumstances Docker would delete my data? Is there some function or feature of Docker that deletes an entire user’s AppData\Local\Docker folder if it thinks it is corrupt or unusable?

One thing I remember from this is I did toggle the Hyper-V role/feature or clicked the ‘Switch to Linux/Windows containers’ choice in the Docker context menu (I can’t remember if it was first set to Windows containers or Linux containers): could this have deleted my data? In trying to get my data back I toggled it back to the previous state and vice versa but I’m not sure what state it began in.

Almost a month has passed since you first asked your question, so I guess it’s too late by now. But: did you also look at the file system when the things went missing, or did you only look in Desktop after you moved and restarted?

I wonder if Desktop is looking at the location you think it’s looking at. If you only looked in Desktop, and if there’s still something on the file system then I’d create a backup of that before trying any other things. (Again, I guess it’s far too late for that today, but maybe it helps in the future.)

The problem is that you can’t be sure that everything every time will work when you do something that is not supported. I am not saying I never do that, but when you do that, you should keep a copy of your data until it is absolutely sure that it works perfectly. Sometimes I don’t take my own advice either and delete files too soon. The next day something happens and I lose everything.

I can’t tell you what went wrong, what deleted the data and why. I know a lot about how Docker handles files and what I can do with them, but not as much in case of Docker Desktop with its virtual machine layer.

Switching between Linux and Windows containers should not delete anything and I don’t know any reason why anything would be deleted and how you could corrupt the vitual machine layer (Hyper-V or WSL) to get the issue you have, but I can tell you what type of corruption I can imagine without knowing if it is actually possible.

For example, let’s say you copied everything you find, but there was something that you did not copy, because it was hidden or in an other directory. If not that, let’s say, there was a file which somehow become corrupted either because something was still writing that file when you started to copy even though you thought Docker desktop was stopped, or because your HDD was unhealthy and it become corrupted after copying it.

Either way, the containers could work, but then Docker Desktop could not properly save its status from memory and next time it could not recognize the data because of inconsistency.

Again, this is just a fiction, which unfortunately will not help you, but the fact that an unsupported or not recommended way seems to be working, doesn’t mean it can’t break your system later. In this case, I really have no idea if it caused the data loss or a bug in Docker Desktop or in the backend