在Docker容器中运行Windows Server Core
问题描述:
我的Linux容器像魅力一样运行,但在我的Docker容器中更改为Windows Server使我疯狂!在Docker容器中运行Windows Server Core
我泊坞文件不建虽然它是我的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或好奇开始5分钟安装SciPy的以前,甚至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
下面是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"
看起来像是有一个网络问题,阻止你的容器从互联网上拉东西。请参阅以下资源:https://github.com/Microsoft/Virtualization-Documentation/tree/master/windows-server-container-tools/CleanupContainerHostNetworking – friism
是的,谢谢。现在工作! –