Python 在Docker容器中运行Windows Server Core
我的Linux容器运行起来很有魅力,但Docker容器中对Windows Server的更改让我抓狂 我的Docker文件与我的linux Docker文件一样简单,但无法生成:Python 在Docker容器中运行Windows Server Core,python,windows,docker,Python,Windows,Docker,我的Linux容器运行起来很有魅力,但Docker容器中对Windows Server的更改让我抓狂 我的Docker文件与我的linux Docker文件一样简单,但无法生成: FROM microsoft/windowsservercore #Install Chocolately RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iwr https://chocolatey.org/install.ps
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
有时我能够通过PIP安装scipy失败,或者奇怪的是在5分钟前开始安装,甚至Chocolate的安装也失败了:
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会话,我已经将其包括在内,以防将来对其他人有用
#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"
看起来有一个网络问题,阻止你的容器从互联网上取东西。请看这些资源:是的,谢谢。现在工作!