无法在 Windows 架构的 docker 映像 microsoft/dotnet:2.1-sdk 中安装节点 [英] Can't install node in docker image microsoft/dotnet:2.1-sdk for windows architecture

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

问题描述

我最初在以下位置问了这个问题:https://github.com/aspnet/aspnet-docker/issues/349 作为弃用公告的一部分,我希望 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:

我正在尝试使用 microsoft/dotnet:2.1-sdk 将 Windows 端用于 SPA 构建.我知道,我可能是唯一一个试图将 ASP.NET Core 应用程序留在 Windows 端的人,但我们的 swarm 最初只会让 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:windowssystem32 中,也不在任何其他目录中.

but msiexec.exe isn't in the c:windowssystem32 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.

我想我的问题是,是否有任何容器本机方式可以在内部安装 node.js,而无需在容器外部下载某些内容,将其复制进去,然后执行它.如果我必须这样做,或者至少在我看来使它成为一个丑陋的解决方案,那么这有点违背了多阶段构建的目的.

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

改为 unzip 使用 Expand-Archive

无法在 nanoserver 中安装 MSI.有关解决方案,请参阅:Powershell Silent Install in Nano Server with Docker

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆