链接Dockerfiles - 从开始运行NPM不再工作?
我正在尝试Docker。我有一个简单的Dockerfile,其中包括Java和Node。
https://github.com/quafadas/quafadas/scala-mill
//github.com/quafadas/scala-mill/blob/master/dockerfile dockerhub。现在,我想在下游构建一个应用程序
FROM quafadas/scala-mill:latest
RUN java -version
#This doesn't work :-(.
RUN npm --version
运行npm - version
在上面链接的基本图像中工作,但显然不是当我使用来自指令。有人能帮助我理解为什么吗?
/bin/sh: npm: command not found
15:15:19
The command '/bin/sh -c npm --version' returned a non-zero code: 127
enter code here
``
I'm experimenting with docker. I have a simple dockerfile, which includes java and node.
https://github.com/Quafadas/scala-mill
https://github.com/Quafadas/scala-mill/blob/master/Dockerfile
It's published to dockerhub. Now, I'd like to build an application downstream
FROM quafadas/scala-mill:latest
RUN java -version
#This doesn't work :-(.
RUN npm --version
The command RUN npm --version
works in the base image linked above, but apparently, not when I'm building on top of it using the FROM
directive. Is anyone able to help me understand why?
/bin/sh: npm: command not found
15:15:19
The command '/bin/sh -c npm --version' returned a non-zero code: 127
enter code here
``
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎最近有几项承诺 repo 显然已经解决了问题!我能够构建并运行Dockerfile,以获取
npm
版本,没有任何问题!如果您需要在不提供它的基本图像上安装其他模块(例如NPM),请使用命令的多阶段dockerfile,具有不同的
稍后,您将必要的依赖项和Docker映像中的单个dockerfile获取。 参考。
There seem to have been a few recent commits to the repo which has apparently fixed the issue! I was able to build and run the Dockerfile to get the
npm
version without any issues!In case you need additional modules (such as npm) to be installed on a base image that doesn't provide it, use a multi-stage Dockerfile with different
FROM
commands to get your necessary dependencies onto a single Dockerfile and a docker image later. Reference.