基于 Windows 的 dockerfile 和 python 安装

问题描述 投票:0回答:1

我想实现一个基于Windows的dockerfile,它也可以用来安装python。 这些是我拥有的一些命令,我想对其中显式安装 python 的部分进行故障排除。

# Use Windows Server Core as the base image
FROM mcr.microsoft.com/windows/servercore:ltsc2022

# Install Python 3.12.2
SHELL ["cmd", "/S", "/C"]

# Download and install Python
RUN curl -o python-installer.exe https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe && \
    python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 && \
    del python-installer.exe
python windows docker dockerfile
1个回答
0
投票

用于 Python 安装的 Dockerfile

FROM mcr.microsoft.com/windows/servercore:ltsc2022

SHELL ["cmd", "/S", "/C"]

RUN curl -Lo python-installer.exe https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe && ^
    python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 && ^
    del python-installer.exe

RUN python --version
© www.soinside.com 2019 - 2024. All rights reserved.