windows icon indicating copy to clipboard operation
windows copied to clipboard

Can it be used as base image for a Dockerfile.windows?

Open AkiraWang89 opened this issue 1 year ago • 9 comments

Hi, I have my own node script that i run on linux. Would it be possible to make it work with windows? I tried importing it but it doesnt work. Did you have some kind of guide on how to setup it correctly for this usecase? Thanks

AkiraWang89 avatar Mar 17 '24 15:03 AkiraWang89

Sorry but I do not really understand what you mean exactly.

kroese avatar Mar 24 '24 23:03 kroese

I mean to use it like a base image, something like

FROM dockurr/windows

ENV IS_DOCKER /tmp/install
ENV INST_SCRIPTS /tmp/install

RUN apt-get install -y dos2unix

WORKDIR /app
COPY . .
EXPOSE 8080

RUN dos2unix container_start_windows.sh
ENTRYPOINT ["bash", "container_start_windows.sh"]

AkiraWang89 avatar Mar 25 '24 13:03 AkiraWang89

I cannot think of any reason why you should not be able to use this image as a base image (because it is possible with every Docker image).

What is the error you run into?

kroese avatar Mar 25 '24 13:03 kroese

Great. I want to run some scripts after install on windows instead of linux. Where to put them?

For example if I add to the Dockerfile: RUN start firefox it will be executed on linux I'm looking for a way to run it on the windows terminal once it's ready

Maybe something like this? But what the ID will be? qm guest exec ID -- c:\\path\\to\\exe /with /arguments

AkiraWang89 avatar Mar 27 '24 11:03 AkiraWang89

See https://github.com/dockur/windows/issues/187 on how to do that.

kroese avatar Mar 28 '24 11:03 kroese

The suggested solution requires editing the xml file wich is part of the base image, so if I use it as it is i cant edit the xml or can I? Exposing some kind of reverse console to windows would be easier to use probably.

AkiraWang89 avatar Mar 29 '24 20:03 AkiraWang89

You override the XML in the base image by

volumes:
  - /example/custom.xml:/run/assets/win11x64.xml

So there is no need to change the image itself.

kroese avatar Mar 29 '24 20:03 kroese

Thats seem more like a docker compose thing, no? A Dockerfile doesnt support volumes

AkiraWang89 avatar Mar 31 '24 00:03 AkiraWang89

Yes those lines need to be added to your composefile, not the dockerfile.

kroese avatar Mar 31 '24 00:03 kroese

Since version 2.22, this can now be done much easier, see: https://github.com/dockur/windows?tab=readme-ov-file#how-do-i-run-a-script-after-installation

kroese avatar Apr 28 '24 11:04 kroese