gpt4 book ai didi

python - 在 Docker 容器中运行 Windows Server Core

转载 作者:可可西里 更新时间:2023-11-01 11:47:17 24 4
gpt4 key购买 nike

我的 Linux 容器运行得非常棒,但是在我的 Docker 容器中对 Windows Server 的更改让我抓狂!

我的 Docker 文件没有构建,尽管它和我的 linux Dockerfiles 一样简单:

FROM microsoft/windowsservercore

#Install Chocolately
RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex)"
ENV PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

#Install python
RUN choco install -fy python2
RUN refreshenv
ENV PYTHONIOINPUT=UTF-8

RUN pip install -y scipy

有时我能够 Chocolately 导致无法通过 PIP 安装 scipy 或奇怪地在 5 分钟前开始,甚至安装 chocolately 失败:

iwr : The remote name could not be resolved: 'chocolatey.org'
At line:1 char:2
+ (iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeWebRequestCommand

以下是我的 Docker for Windows 安装的一些规范:

Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 3
Server Version: 1.13.0
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 14393 (14393.693.amd64fre.rs1_release.1612
Operating System: Windows 10 Education
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.903 GiB
Name: xxxx
ID: deleted
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 18
System Time: 2017-01-31T16:14:36.3753129+01:00
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

有什么想法吗?

最佳答案

我无法让 refreshenv 工作,所以我使用了多个 powershell session ,我已经包括在内以防将来对某人有用。

#Install Chocolately, Python and Python Package Manager, each PowerShell session will reload the PATH from previous step
RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex"
RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "choco install -y python3"

关于python - 在 Docker 容器中运行 Windows Server Core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41961078/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com