windows icon indicating copy to clipboard operation
windows copied to clipboard

[Question]: use a vhdx into docker container

Open lom4f1 opened this issue 1 year ago • 11 comments

Is your question not already answered in the FAQ?

  • [X] I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • [X] I am sure my question is not about a technical issue.

Question

I have been able to use a new W11 installation into a container. That's great. I would like to use a preconfigured Windows image into a docker container. Is it possible? I tried with a vhdx or a iso files but without success. As far as my understanding, this repository does not work for this puspose. Am I correct? Is there any way to achieve that target? What I need is apreconfigured windows machine to instantiate as many times as needed. Thanks.

lom4f1 avatar Jul 16 '24 08:07 lom4f1

Hi, Yes, you install your Windows, your applications, etc. In the end, you have a windows.base file. If you create a second container, for example, you can use this file, and you'll have your preinstalled Windows image. I hope that's clear.

mike37510 avatar Jul 16 '24 16:07 mike37510

Thank you for the reply. I did it, but porta didn't work. For example, if I want to have two machines one on 8006 and the orther one on 8007, the second one cannot be accessed via vnc. I also tried to recompile the whole image exposing more ports, but in this case nothing can be accessed via vnc. Any further suggestions? Thank you in avance.

Il Mar 16 Lug 2024, 18:48 MikeLaMenace @.***> ha scritto:

Hi, Yes, you install your Windows, your applications, etc. In the end, you have a windows.base file. If you create a second container, for example, you can use this file, and you'll have your preinstalled Windows image. I hope that's clear.

— Reply to this email directly, view it on GitHub https://github.com/dockur/windows/issues/651#issuecomment-2231385339, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ4NMRBBA4Z2QUFFH3AOD33ZMVFE5AVCNFSM6AAAAABK6CGWESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZRGM4DKMZTHE . You are receiving this because you authored the thread.Message ID: @.***>

lom4f1 avatar Jul 16 '24 16:07 lom4f1

Did you create two Docker Compose files then?

Exemple >> https://www.borninthe80s.fr/2024/07/17/poc-fournir-des-environnements-windows-sur-des-hotes-linux-via-docker/

mike37510 avatar Jul 16 '24 23:07 mike37510

Great link. That script will be useful, for sure. Thank you very much!

But I still have some questions, if you do not mind. :)

  1. my purpose is to use an already existing windows image (already configured) to "clone" the other containers, but the problem is exposed ports. If I use the image created from a container obtained from a docker/windows image, it seems to work only the port used in the first creation process of the container (the one started from initial docker/windows installation).
  2. the script is useful to have a line to follow, but my use case is clone/create windows containers starting from the one already configured once needed. For example: a) I have docker container running W11 configured with some SWs running and settings (it uses 8006 port for vnc, it uses user1 and the machine name is windows1) b) I would create an image from that, to be used just in case to create a new container (let's say windows2, with user2 and port 8007)

I am having trouble doing that.

Thank you in advance for eventual further support.

Il giorno mer 17 lug 2024 alle ore 01:44 MikeLaMenace < @.***> ha scritto:

Did you create two Docker Compose files then?

Exemple >> https://www.borninthe80s.fr/2024/07/17/poc-fournir-des-environnements-windows-sur-des-hotes-linux-via-docker/

— Reply to this email directly, view it on GitHub https://github.com/dockur/windows/issues/651#issuecomment-2232001508, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ4NMRDGYZL3UIMJADG7573ZMWV67AVCNFSM6AAAAABK6CGWESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSGAYDCNJQHA . You are receiving this because you authored the thread.Message ID: @.***>

lom4f1 avatar Jul 17 '24 08:07 lom4f1

Ok, I found the problem of the ports. My fault in configuration. It works. Sorry. What is not working now is the image created from the configured windows container. What I have done is create the image from already configured container: docker commit <container_id> custom-windows-image Then I put that image reference into the compose file to create new containers like:

services: windows: image: custom-windows-image:latest container_name: windows-node1 ... windows-2: image: custom-windows-image:latest container_name: windows-node2 ...

But starting the containers: docker-compose up -d Windows is downloaded and installed from 0 and the already configured image seems to be not used at all. Where is my mistake? :)

Thanks.

Il giorno mer 17 lug 2024 alle ore 10:49 Marco Filippeschi < @.***> ha scritto:

Great link. That script will be useful, for sure. Thank you very much!

But I still have some questions, if you do not mind. :)

  1. my purpose is to use an already existing windows image (already configured) to "clone" the other containers, but the problem is exposed ports. If I use the image created from a container obtained from a docker/windows image, it seems to work only the port used in the first creation process of the container (the one started from initial docker/windows installation).
  2. the script is useful to have a line to follow, but my use case is clone/create windows containers starting from the one already configured once needed. For example: a) I have docker container running W11 configured with some SWs running and settings (it uses 8006 port for vnc, it uses user1 and the machine name is windows1) b) I would create an image from that, to be used just in case to create a new container (let's say windows2, with user2 and port 8007)

I am having trouble doing that.

Thank you in advance for eventual further support.

Il giorno mer 17 lug 2024 alle ore 01:44 MikeLaMenace < @.***> ha scritto:

Did you create two Docker Compose files then?

Exemple >> https://www.borninthe80s.fr/2024/07/17/poc-fournir-des-environnements-windows-sur-des-hotes-linux-via-docker/

— Reply to this email directly, view it on GitHub https://github.com/dockur/windows/issues/651#issuecomment-2232001508, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ4NMRDGYZL3UIMJADG7573ZMWV67AVCNFSM6AAAAABK6CGWESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSGAYDCNJQHA . You are receiving this because you authored the thread.Message ID: @.***>

lom4f1 avatar Jul 17 '24 09:07 lom4f1

In my opinion, you should install Windows, and then retrieve the data.img that you will use as the "source". Next, create your Docker Compose files, but before starting, copy your data.img into the directory. You'll see that the OS is already installed.

mike37510 avatar Jul 17 '24 10:07 mike37510

Ok, let's say I have a vhdx file containing windows data. How should I handle it? Should I create a new image to be used in the docker-compose file or can it be handled directly by the docker-compose file? How? :) Thanks.

Il giorno mer 17 lug 2024 alle ore 12:09 MikeLaMenace < @.***> ha scritto:

In my opinion, you should install Windows, and then retrieve the data.img that you will use as the "source". Next, create your Docker Compose files, but before starting, copy your data.img into the directory. You'll see that the OS is already installed.

— Reply to this email directly, view it on GitHub https://github.com/dockur/windows/issues/651#issuecomment-2232937158, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ4NMRA6W54R44ERUBGNR53ZMY7ERAVCNFSM6AAAAABK6CGWESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSHEZTOMJVHA . You are receiving this because you authored the thread.Message ID: @.***>

lom4f1 avatar Jul 17 '24 14:07 lom4f1

I don't know about that. "At worst," just reinstall directly in the correct format. I don't know the format used by Dockurr for its .img. Maybe it's the native QEmu format... If necessary, try converting the VHDX to .img via this guide. That's what I would try otherwise.

mike37510 avatar Jul 17 '24 18:07 mike37510

this good ?

mike37510 avatar Jul 18 '24 12:07 mike37510

Actually I am not able to make it works. I am trying the last option I was thinking about: copy files from storage folder of container (data.img, windows.base, windows.boot, ...) in order to use them in new container creation process (I do not know how to do that yet). I hope those files clone exactly the configured image in a new container without installing Windows from zero as dockurr/windows project does. I am spending to much time looking for a solution to my task, but I am still not finding it. :( I cannot understand how to use a custom image instead of standard windows installation one. I suppose the reference in the readme file is related to a different image for installation...

... use a local file instead, by binding it in your compose file in this way:

volumes:
  - /home/user/example.iso:/custom.iso

lom4f1 avatar Jul 18 '24 12:07 lom4f1

At the end I have been able to use a previous container windows image using files from /storage folder of container. The files data.img, windows.base, etc... copied in a new docker image, can be used to create containers all with the same windows image. This solved my needs, but I am afraid some binding are lost because I cannot see anymore the content of oem folder in the container directly in the oem folder on windows, mounted as volume like: volumes: - ./scripts:/oem I can see the scripts folder content in the oem folder of the container, but nor into the oem folder in Windows. Is there anyway to restore the volume mounting?

lom4f1 avatar Jul 25 '24 13:07 lom4f1