I must be doing something fundamentally wrong, but I can’t seem to figure it out.
I have Docker Desktop 3.5.2 installed on a Windows 10 Enterprise machine (20H2), using the WSL 2 engine. I had been working with Linux containers and was able to build images and run containers without a problem.
I wanted to start working with Windows containers, so I right-clicked the Docker icon in the system tray and selected “Switch to Windows containers…”. I created a simple Dockerfile:
FROM mcr.microsoft.com/windows/nanoserver:20H2
RUN echo "Hello World 1"
RUN echo "Hello World 2"
If I execute:
docker build -t test -f "./Dockerfile" .
I get the following output:
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM mcr.microsoft.com/windows/nanoserver:20H2
20H2: Pulling from windows/nanoserver
d33d999f2c9c: Pull complete
Digest: sha256:1eaf8acfc9f6bad4035fdf663873b685ad654d27bf30cc056a0a2af74b922c4d
Status: Downloaded newer image for mcr.microsoft.com/windows/nanoserver:20H2
---> 695bc2c82a9f
Step 2/3 : RUN echo "Hello World 1"
---> Running in fe3334e5e10d
"Hello World 1"
re-exec error: exit status 1: output: hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)
I suspected it might be due to the WSL 2, but the same thing happens if I disabled the WSL 2 and use Hyper-V instead.
Any suggestions?