为什么Dockerfile中的单独RUN无法构建但链接的RUN成功完成?

时间:2018-08-02 07:11:52

标签: powershell docker dockerfile

Dockerfile看起来像这样:

FROM microsoft/windowsservercore

COPY sources sources

RUN powershell -Command Add-WindowsFeature NET-WCF-HTTP-Activation45
RUN powershell -Command Add-WindowsFeature Net-Framework-Core -Source C:\sources\sxs

ENTRYPOINT powershell

由于第二个Add-WindowsFeature命令发生超时错误,因此使用上述Dockerfile构建映像始终会失败。

  

由于超时时间已过,此操作返回。 (0x5b4)

但是,如果我这样编写Dockerfile,它将成功构建:

FROM microsoft/windowsservercore

COPY sources sources

RUN powershell -Command Add-WindowsFeature NET-WCF-HTTP-Activation45; \
                        Add-WindowsFeature Net-Framework-Core -Source C:\sources\sxs

ENTRYPOINT powershell

我在文档中找不到任何信息,为什么在Dockerfile中为同一命令(即powershell -Command Add-WindowsFeature ...)使用两个单独的RUNS无法正常工作。

0 个答案:

没有答案
相关问题