Dockerfile和问题安装工作

我试图执行凉亭安装节点上:4.1.2泊坞窗容器从docker文件。

我的dockerfile的一部分是这样的:

#Install bower to command line RUN npm install -g bower # Define the host folder that will contain the code WORKDIR /application # Copy src to application host folder** ADD . /application # RUN move to /application/public/webapp where there is a bower.json file and install it** RUN cd public/webapp && bower install --allow-root --config.interactive=false ENTRYPOINT ["npm"] CMD ["start"] 

build立它。

该dockerfile不构buildbower_components文件夹,尽pipe显示:

 Step 9 : RUN cd public/webapp && bower install --allow-root --config.interactive=false ---> Running in 937ad6c21887 /application/public/admintool bower angular#1.4.7 not-cached git://github.com/angular/bower-angular.git#1.4.7 bower angular#1.4.7 resolve git://github.com/angular/bower-angular.git#1.4.7 bower angular#1.4.7 download https://github.com/angular/bower-angular/archive/v1.4.7.tar.gz bower angular#1.4.7 extract archive.tar.gz bower angular#1.4.7 resolved git://github.com/angular/bower-angular.git#1.4.7 bower angular#1.4.7 install angular#1.4.7 angular#1.4.7 bower_components/angular 

如果我进入容器,凉亭被认为是一个命令 (它安装它)。 运行凉亭安装从/应用程序/公共/ Web应用程序如果在容器内Im。 从dockerfile它只是没有做任何事情。 也没有抱怨。

有谁知道为什么?

你是否可能通过docker-compose.yml文件或docker run命令中的-v参数将主机上的卷装入容器?

我问,因为你提到你没有在你的机器上安装凉亭,所以你可能没有在你的代码库的主机副本中的bower_components文件夹。 如果您然后运行您的容器并将包含主机上的源卷的容器挂载到容器中,那么bower_components文件夹将会丢失,从而解释为什么它似乎从容器中消失。

我会首先testing,看看是否确实是这样的问题,因为不从主机装入任何卷,并在构build并运行容器后看到bower_components文件夹是否保留。 然后,您可以在主机上安装bower并运行bower install,以便在开发过程中安装的音量不会造成问题。