在 Docker 容器中运行 Windows Server Core



我的 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%chocolateybin 
#Install python
RUN choco install -fy python2
RUN refreshenv
ENV PYTHONIOINPUT=UTF-8
RUN pip install -y scipy

有时我能够巧克力,这导致无法通过 PIP 安装 scipy,或者好奇地在 5 分钟前开始,甚至安装巧克力也失败:

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:ProgramDataDocker
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"

最新更新