dockur / windows

Windows inside a Docker container.
MIT License
29.23k stars 1.99k forks source link

[Question]: How to simply clone a container containing a specific Windows version #766

Closed avilesjf closed 1 month ago

avilesjf commented 1 month ago

Is your question not already answered in the FAQ?

Is this a general question and not a technical issue?

Question

1/ How to clone a container containing a specific Windows version? With a docker compose I have installed a Windows home version (thanks to the MANUAL: "Y" option). But in this case, Windows installation is very long with a lots of keyboard interactions. So now, I need to duplicate this container with the Windows home working in this clean status. In order to test again and again with a clean state starting as a new install. I tried with the commit function but it duplicates as an image state and not the container as is. And if I do a docker run on this new image (as I read on the net), a new container creation is done from scratch. So don't bother me on the command line with Linux examples, I'm using Docker Desktop on Windows 11 and building Windows 11 Home in this case. 2/ Second question, is there another way to create a Windows home like the "win11" pro directly? With a specific xml config from someone or how to do it?

I know that this option for Windows home was not retained for reasons of network limitations but I need it to simulate Windows behavior in a Windows home environment (in French lang in my case).

And thanks to everyone for your help and especially to all the creators of this github project!

kroese commented 1 month ago

Inside the /storage volume there is a file called data.img that contains the whole harddisk.

So the only thing you need to do for instant installations is to provide an existing /storage volume, which can be binded to a local folder like this:

volumes:
  - /example/folder:/storage

So for backing up or restoring machines, all you need to do is make a copy of /example/folder. And if you have multiple folders, you can easily switch between them by changing that line in your compose file.

avilesjf commented 1 month ago

Thank you for your answer. After adding this, I see the data.img file. When I run a new compose linked to this previous data.img file. The process generate a new instance from scratch. How to use it on a new container linked to this duplicate disk? I hope that this new disk is not only a data disk (like d:) but the complete windows booting system.

kroese commented 1 month ago

Just copy the whole folder and name it /home/machine2 for example. Then modify the compose:

volumes:
  - /home/machine2:/storage
avilesjf commented 1 month ago

Oh yes, it works fine! Thank you for your quick help. Have a good week.