简体   繁体   English

Win10 Professional Dockerizing Augular App提供:未知说明:EXPAND-ARCHIVE

[英]Win10 Professional Dockerizing Augular App gives: unknown instruction: EXPAND-ARCHIVE

I am going to create a docker image of angular web application to other windows machine. 我将为其他Windows机器创建角度Web应用程序的docker映像。 When it comes to the command execution : 当涉及到命令执行时:

docker build -t node .

It gives the following exception: 它给出以下异常:

Error response from daemon: Dockerfile parse error line 10: unknown instruction: EXPAND-ARCHIVE

Would you please tell me how to correct the line 10 so that the zip file can be extracted ? 您能告诉我如何更正第10行,以便可以提取zip文件吗?

Here is my Dockerfile 这是我的Dockerfile

FROM mcr.microsoft.com/windows/servercore:1803 as installer

ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 8.11.0
ENV NODE_SHA256 7b2409605c871a40d60c187bd24f6f6ddf10590df060b7d905ef46b3b3aa7f81

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]

RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing "https://nodejs.org/dist/v8.11.0/node-v8.11.0-win-x64.zip";
Expand-Archive nodejs.zip -DestinationPath C:\; 
Rename-Item "C:\\node-v8.11.0-win-x64" c:\nodejs

FROM mcr.microsoft.com/windows/nanoserver:1803

WORKDIR C:\nodejs
COPY --from=installer C:\nodejs\ .
RUN SETX PATH C:\nodejs
RUN npm config set registry https://registry.npmjs.org/

WORKDIR /app

# install and cache app dependencies
COPY src/WebSpa/package.json /app/src/WebSpa/package.json

WORKDIR /app/src/WebSpa
RUN npm install
RUN npm install -g @angular/cli@latest

# add app
COPY . /app

# start app
CMD cd /app/src/WebSpa && ng serve --host 0.0.0.0

You have a line return in your Dockerfile RUN command, causing it not to chain the powershell commands but instead try and execute the second one as a Docker command. 您的Dockerfile RUN命令中有一行返回,导致它没有链接powershell命令,而是尝试将第二条命令作为Docker命令执行。

It should look like this: 它看起来应该像这样:

RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing "https://nodejs.org/dist/v8.11.0/node-v8.11.0-win-x64.zip"; Expand-Archive nodejs.zip -DestinationPath C:\; Rename-Item "C:\\node-v8.11.0-win-x64" c:\nodejs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM