【发布时间】:2019-01-27 10:10:31
【问题描述】:
我的目标是创建一个我可以做到的容器:
- 输入数据
- 处理可执行 (.exe) 文件中的数据
- 输出处理后的数据
我想使用 NodeJS 来处理使用 REST 的输入/输出。 因此,我需要在容器上安装 NodeJS 以及可执行文件的依赖项。
我的 Dockerfile 现在看起来像这样:
FROM microsoft/windowsservercore
COPY installers installers
COPY sources sources
COPY ProjectXYZ ProjectXYZ
# Install NodeJS and dependencies
RUN cd C:\installers && \
msiexec.exe /qn /i "node-v8.11.3-x64.msi" && \
Jet40SP8_9xNT.exe /Q && \
setup.exe /configure configuration.xml && \
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:C:\sources\sxs && \
DISM /Online /Enable-Feature /FeatureName:NetFx4 /All /LimitAccess && \
cd C:\ && \
rmdir /s /q sources && \
rmdir /s /q installers
# Start the service
ENTRYPOINT "cd C:/ProjectXYZ && node server.js"
这个 Dockerfile,虽然由于一些下载需要很长时间,但构建成功。
PS C:\projectxyz> docker build -t projectxyz .
Sending build context to Docker daemon 207.1MB
Step 1/6 : FROM microsoft/windowsservercore
---> 7d89a4baf66c
Step 2/6 : COPY installers installers
---> Using cache
---> 1538d7a0ba9d
Step 3/6 : COPY sources sources
---> Using cache
---> 659167fb1238
Step 4/6 : COPY HiperPlantNodeJS HiperPlantNodeJS
---> Using cache
---> e8295924e730
Step 5/6 : RUN cd C:\installers && Jet40SP8_9xNT.exe /Q && msiexec.exe /qn /i "node-v8.11.3-x64.msi" && setup.exe /configure configuration.xml && DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:C:\sources\sxs && DISM /Online /Enable-Feature /FeatureName:NetFx4 /All /LimitAccess && cd C:\ && rmdir /s /q sources && rmdir /s /q installers
---> Using cache
---> 1ebbf13b0d3c
Step 6/6 : ENTRYPOINT "cd C:/HiperPlantNodeJS && node server.js"
---> Running in c8a8af429021
Removing intermediate container c8a8af429021
---> c042e6756ef4
Successfully built c042e6756ef4
Successfully tagged projectxyz:latest
PS C:\projectxyz>
但是,运行构建的镜像时总是会出现超时错误。
PS C:\projectxyz> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
projectxyz latest 1519b739fc1d 7 minutes ago 14.4GB
microsoft/windowsservercore latest 7d89a4baf66c 5 weeks ago 10.7GB
PS C:\projectxyz> docker run --name=xyz01 -p 8765:4321 -d hpnodejs-cmd
74b8a68f25dac38fa715611d597c017b63ba1376974f63f91e10c645df5b2e0e
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container 74b8a68f25dac38fa715611d597c017b63ba1376974f63f91e10c645df5b2e0e encountered an error during Start: failure in a Windows system call: This operation returned because the timeout period expired. (0x5b4)
但是,如果我以交互方式运行映像(没有依赖项)并在容器中手动安装依赖项,那么一切正常。容器和项目按预期运行。
我正在尝试创建的系统需要创建此容器的多个副本并以分离模式运行每个副本。所以为每个容器手动安装依赖已经不可能了。
主要问题:如何才能成功运行此映像?
运行大图像有限制吗? 因为如您所见,安装依赖项后,映像现在为 14.5GB。 我在文档中找不到任何提及。
感谢您的帮助..
【问题讨论】:
-
你找到答案了吗?我有一个类似的问题。我正在尝试自己运行 MS SQL 开发人员容器 dockerfile (github.com/Microsoft/mssql-docker/blob/master/windows/…)(以添加全文搜索),但我一直收到同样的错误。 CreateComputeSystem 5cd46655260f2b36904b1915b060319607bac5940281b4c4a8d485b072d5558c:此操作返回,因为超时时间已过。
-
很抱歉,但我没有……在我发布这个问题几个小时后,我通过 Mono 在 Ubuntu 容器中运行我们的系统的请求得到了批准。所以我完全放弃了这个实现。我不回答这个问题,以防有人回答。
标签: windows-10 docker-for-windows docker-build docker-run docker