我尝试使用标准Sails.js
Docker镜像启动并运行我的node
应用,但在尝试npm install bcrypt
时构建失败。
> bcrypt@0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: node-v0.10.33.tar.gz local checksum 822ba41f2d77b704ab63e244dfef7431b31893c19bfe3bf228c06b6aff063ed5 not match remote 75dc26c33144e6d0dc91cb0d68aaf0570ed0a7e4b0c35f3a7a726b500edd081e
gyp ERR! stack at deref (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:299:20)
gyp ERR! stack at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:340:13)
gyp ERR! stack at IncomingMessage.emit (events.js:117:20)
gyp ERR! stack at _stream_readable.js:943:16
gyp ERR! stack at process._tickCallback (node.js:419:13)
gyp ERR! System Linux 3.16.1-tinycore64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /pos/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
或者有时它只是失败如下:
> bcrypt@0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild
Killed
有时它会无限期挂在
> bcrypt@0.8.0 install /pos/node_modules/bcrypt
> node-gyp rebuild
Dockerfile
看起来像:FROM node:0.10.33
# copy the source files into the image
ADD . /myapp
# Define working directory.
WORKDIR /myapp
# Install node-gyp as global and ensure it's all clean and tide
RUN npm install -g node-gyp && \
node-gyp clean && \
npm cache clean
# Install project dependencies
RUN npm install
# Expose sails port (still in development mind you)
EXPOSE 1337
# Define default command.
CMD ["node app"]
RUN apt-get -y install g++
,但将其添加到我的Dockerfile
没有任何区别,只报告g++ is already the newest version.
openssl
已安装,因此我添加了RUN apt-get install -y openssl
,并报告了openssl is already the newest version
。RUN apt-get install -y build-essential
,但也报告说它已经是最新版本。我已经看到过Node需要安装为legacy
版本的建议,这是标准Node图像应该负责的内容,如果有必要,我相信,所以我也是报告为an issue with the docker-library/node项目。
与此同时,我还应该尝试什么?
答案 0 :(得分:0)
感谢所有在评论和答案中提出建议的人引导我得出结论。
问题是我的docker
安装中存在某种损坏,或者dvm
和fig
之间存在某种不兼容问题,但我解决了以下问题
dvm down
brew remove fig
brew remove dvm
brew remove docker
brew cleanup --force -s
rm -rf ~/VirtualBox VMs/boot2docker-vm
brew install docker
brew install boot2docker
boot2docker init
boot2docker up
echo export DOCKER_TLS_VERIFY=1 > ~/.bash_profile
echo export DOCKER_CERT_PATH=~/.boot2docker/certs/boot2docker-vm > ~/.bash_profile
echo export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 > ~/.bash_profile
export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
brew install fig
fig build web
并且瞧 - 它有效。
诀窍似乎是我原来的boot2docker-vm
中有一些相互矛盾的问题,最初是通过安装程序安装的,后来是homebrew
和boot2docker
以某种方式与dvm
发生冲突。通过将它全部擦回裸露金属并从头开始重建,它们都能很好地工作。