Making Windows Image in Docker WSL2

I am trying to build a Windows image in WSL2 docker engine and am not having any success. Following are the steps I did

1- created Dockerfile
> FROM Microsoft Artifact Registry
> COPY hello-world.exe /opt/hello-world.exe
> CMD [“/opt/hello-world.exe”]

2- docker build -t my-windows-image .
3- Getting the following error
ERROR: failed to solve: failed to register layer: link /Files/Program Files/common files/Microsoft Shared/Ink/en-US/micaut.dll.mui /Files/Program Files (x86)/common files/Microsoft Shared/ink/en-US/micaut.dll.mui: no such file or directory

I did install WSL2 docker engine from The Wonderland of WSL 2 for Windows and Docker Engine Support – bearandhammer. I can build a Linux image and run it properly. It is when I try to do a windows image that I am having problems.

Any advice is appreciated.

TIA

Asif

Windows containers can run only on Windows and Linux containers on Linux. When you see it otherwise it is probably a virtual machine with the required operating system. WSL2 is Linux so you will never be able to run a Windows container in a WSL distribution. Building an image also means running a container and saving it as an image, so that is not possible either.

If you are using Docker Desktop, then switch to Windows containers and you can build windows images.

3 posts were split to a new topic: Creating WSL2 context on Windows