本文介绍了无法在Windows架构的docker image Microsoft / dotnet:2.1-sdk中安装节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最初在以下位置问了这个问题:作为弃用声明的一部分,我希望SO社区对此有一个好的答案:

I asked this question originally at: https://github.com/aspnet/aspnet-docker/issues/349 as a part of the deprecation announcement, and I am hoping the SO community may have a good answer for this:

I我正在尝试使用 microsoft / dotnet:2.1-sdk 将Windows端用于SPA构建。我知道,我可能是唯一一个试图停留在ASP.NET Core应用程序的Windows端的人,但是最初我们的团队只会将Windows服务器以本机OS模式而不是Hyper-V模式运行。

I am trying to use the windows side for a SPA build using the microsoft/dotnet:2.1-sdk. I know, I may be the only one trying to stay on the windows side for an ASP.NET Core Application, but our swarm initially will only have windows servers running in the native OS mode and not Hyper-V mode.

因此,我需要为Windows安装node.js(因为node.js / grunt / gulp不再是图像的一部分,就像它们在 microsoft中一样/aspnetcore:2.0 图片),然后尝试:

As a consequence, I need to install node.js for windows (because node.js/grunt/gulp are no longer a part of the image like they were in the microsoft/aspnetcore:2.0 image) and I tried:

RUN msiexec.exe /a https://nodejs.org/dist/v8.11.3/node-v8.11.3-x64.msi /quiet

msiexec.exe 不在此图像的c:\windows\system32或任何其他目录中。

but msiexec.exe isn't in the c:\windows\system32 of this image or in any other directory for that matter.

curl 也不在这张图片中,所以我不能用它来下载任何东西,即使我怎么能解压缩或解压缩任何东西?

curl also is not in this image so I can't use that to download anything, and even if I could how do I un-tar or unzip anything?

我无法运行以下功能的Powershell调用:

I can't run a powershell invocation of:

iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

尝试从此处安装Chocolatey以安装节点因为 System.Net.WebClient 在此图像中不可用。

to try to install chocolatey to install node from there as System.Net.WebClient is not available in this image.

我想我的问题是是否有任何容器本机方式来获取节点。 js是内部安装的,无需下载容器外部的东西,将其复制到内部然后执行。如果我必须这样做或至少在我看来使它成为丑陋的解决方案,则Kinda会破坏多阶段构建的目的。

I guess my question is is there any container native way to get node.js installed internally without having to download something outside the container, copying it in, and then executing it. Kinda defeats the purpose of a multistage build if I have to do that or at least in my opinion makes it an ugly solution.

推荐答案

代替 curl 使用powershell的 Invoke-WebRequest

instead curl use powershell's Invoke-WebRequest

解压缩使用扩展存档

在nanoserver中安装MSI不可能。有关解决方案,请参见:

installing MSI in nanoserver is not possible. For solution see: Powershell Silent Install in Nano Server with Docker

这篇关于无法在Windows架构的docker image Microsoft / dotnet:2.1-sdk中安装节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 19:11