I want to create a docker container using base image mcr.microsoft.com/dotnet/framework/runtime:4.8.1
but I also need Python on here. Unfortunately the official Python images only use windowsservercore
. What do I put in my Dockerfile to make this happen? All the documentation I see are either for linux/unix or require manually downloading an exe beforehand.
You can add installer file and trigger it from powershell with proper commands. There is documentation on how to do it: https://docs.python.org/3.10/using/windows.html#installing-without-ui
Here is the code I have used
ADD https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe C:/python3.exe
RUN powershell -Command \
$ErrorActionPreference = 'Stop'; \
Start-Process c:\python3.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait ; \
Remove-Item c:\python3.exe -Force
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With