Docker& SailsJS

时间:2016-06-04 00:56:23

标签: sails.js dockerfile

我试图使用docker运行风帆应用。但码头工程建筑失败了。以下是 Dockerfile 的内容。

FROM nodesource/jessie:6.2

RUN apt-get update
RUN apt-get -y install wget
RUN apt-get -y install curl
RUN apt-get -y install nano
RUN apt-get -y install tree
RUN apt-get -y install tmux
RUN npm install sails@0.12.3 -g

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install

EXPOSE 1337
ENV NODE_ENV production
ENV PORT 80

CMD ["npm","start"]

我尝试使用不同的节点版本,如4.4,5.2,6.2等。并且总是在同一点上失败,帆安装。

错误代码

Step 8 : RUN npm install sails@0.12.3 -g
 ---> Running in b225cdb580fd
npm WARN deprecated lodash@2.4.1: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated grunt-lib-contrib@0.7.1: DEPRECATED. See readme: https://github.com/gruntjs/grunt-lib-contrib
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated native-or-bluebird@1.1.2: 'native-or-bluebird' is deprecated. Please use 'any-promise' instead.
Killed
The command '/bin/sh -c npm install sails@0.12.3 -g' returned a non-zero code: 137

你们有任何想法解决这个问题吗? 感谢

1 个答案:

答案 0 :(得分:1)

根据错误日志,您可以尝试使用sailsJS的最新发行版,或者如果您需要使用指定的版本,请尝试使用旧版本的nodeJS构建docker镜像。检查此目标版本成功运行的节点版本,并将其添加到Dockerfile。

还尝试在Dockerfile中添加RUN命令。它将帮助您减少Docker镜像的大小。