Docker与Node.js和Express.js

我试图使用我的节点应用程序泊坞窗,我的Dockerfile看起来像这样:

RUN apt-get update RUN apt-get -y install build-essential RUN apt-get install -y nodejs RUN apt-get install -y npm ADD . /src RUN cd /src && npm install EXPOSE 8080 CMD ["node","/src/app.js"] 

但是在运行docker buildnpm install正在运行之后,试图安装https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz我得到一个错误:

 The command 'bin/sh -c /src && npm install' returned a non-zero code : 1 

什么会导致这样的问题? 我已经尝试安装node-legacy而不是节点,它不起作用

尝试这个:

 # put this line on your code (if you are using ubuntu) # this make a link from nodejs to node to add compatibility on ubuntu OS RUN ln -s /usr/bin/nodejs /usr/bin/node # set your current directory with WORKDIR WORKDIR /src RUN sudo npm install