Troubleshooting Windows Server Core Container Build Issues with Python

I’m facing difficulties while trying to build Windows Server Core containers using Python images, specifically with the tag python:3.9-windowsservercore. I can successfully build containers using other Python tags, but I’m encountering issues with these Windows Server Core-based images.

Here’s my Dockerfile contents:

FROM python:3.9-windowsservercore

However, when I attempt to build the container, I encounter the following error:

=> ERROR [internal] load metadata for
 > [internal] load metadata for
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:d80b99d74aea127674d43c3e42d572bd2c718d6355680eeafdc1368ecb821daf: not found

I’ve confirmed that the image I’m trying to use is available on Docker Hub, and you can find it at the following link: Python 3.9 on Windows Server Core.

I’ve also tried using a different Python version tag, such as python:3.10-windowsservercore, as an alternative, but I encountered a similar issue. I can successful use images of Linux distributions (like bullseye, bookworm, and alpine) and they all work fine. My host machine is running Windows 10 OS.

Switch to Windows containers. Click on the whale icon in the notification area and choose “Switch to Windows containers”. Windows containers will not run in Linux containers mode.

1 Like

Thanks that works!
However I see that the ARGs like ARG POETRY_VERSION=1.6.1 cannot be recognized using windows server. So I have to use PowerShell on windows containers right ? Like running the following RUN pip install "poetry==${POETRY_VERSION}" ? gives the error: Step 6/12 : RUN pip install "poetry==${POETRY_VERSION}" ---> Running in 609f34cd587d ERROR: Could not find a version that satisfies the requirement poetry== (from versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.0.post1, 0.4.1,...., 1.6.1) ERROR: No matching distribution found for poetry==