Gruntjs grunt cli不';t安装docker音量时工作,无需

Gruntjs grunt cli不';t安装docker音量时工作,无需,gruntjs,docker,Gruntjs,Docker,我使用下面的Dockerfile设置了一个角度开发环境(除非你真的很热情,否则不要尝试构建它,这需要一段时间) 如果我使用以下命令运行此命令: sudo docker run -it me/angular /bin/bash 我可以毫无问题地使用grunt build。由于我还没有将卷附加到dist,因此该构建对于其他容器(如Web服务器)没有任何用处。但是跑步: sudo docker run -itv /home/me/code/correspondence/client/dist:/ho

我使用下面的Dockerfile设置了一个角度开发环境(除非你真的很热情,否则不要尝试构建它,这需要一段时间)

如果我使用以下命令运行此命令:

sudo docker run -it me/angular /bin/bash
我可以毫无问题地使用
grunt build
。由于我还没有将卷附加到
dist
,因此该构建对于其他容器(如Web服务器)没有任何用处。但是跑步:

sudo docker run -itv /home/me/code/correspondence/client/dist:/home/angular me/angular /bin/bash
导致
grunt build
命令在容器中不再可用:

grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

唯一的区别是添加卷。添加卷是如何导致这种不同行为的?

我想这是因为您已将一些文件放置在图像中的
/home/angular
中,并且当您将卷装载到同一路径(
/home/angular
)时,卷会隐藏原始文件

引自:

注意:如果路径
/opt/webapp
已存在于容器的 图像,其内容将替换为上的
/src/webapp
的内容 主机将与装载的预期行为保持一致


尝试将卷装载到另一个目录,例如,
/home/angular/dist/client

我想这是因为您已将一些文件放置到映像中的
/home/angular
,当您将卷装载到同一路径(
/home/angular
)时,卷会隐藏原始文件

引自:

注意:如果路径
/opt/webapp
已存在于容器的 图像,其内容将替换为上的
/src/webapp
的内容 主机将与装载的预期行为保持一致


尝试将卷装载到另一个目录,例如,
/home/angular/dist/client

对不起,我应该在问题中说,将
添加到Dockerfile中是一件我试图看看是否有帮助的事情,但我得到了同样的行为。我想我可能已经找到了问题所在,如果我今天有时间的话,我会确认问题的原因并在这里发布。对不起,我应该在问题中说,在Dockerfile中添加
,我试着看看是否有帮助,但我得到了同样的结果。我想我可能已经找到了问题所在,如果我今天有时间,我会确认是什么原因造成的,然后在这里发布。
grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started