运行docket容器时遇到问题,收到错误:
error: uncaughtException: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.
这是一个完整的堆栈跟踪:http://pastebin.com/qV0hzRxL
这是我的Dockerfile:
FROM node:6.7-slim
# ----- I added this, but it didn't help
RUN apt-get update && apt-get install -y gcc g++
RUN gcc --version
RUN g++ --version
# ------------------------------------
WORKDIR /usr/src/app
ENV NODE_ENV docker
RUN npm install
CMD ["npm", "start"]
sudo docker-compose build --no-cache chat-ws
(chat-ws
是图片名称)sudo docker-compose up chat-ws
以错误结束。注意:Docker镜像是docker-compose
中作品的一部分。
<小时/> 编辑:
docker-compose.yml
的部分内容
chat-ws:
build: ./dockerfiles/chat-ws
links:
- redis
- chat-api
ports:
- 3000:3000
volumes_from:
- data_chat-ws
<小时/> 和:
data_chat-ws:
image: node:6.7-slim
volumes:
- ${PATH_CHAT_WS}:/usr/src/app
command: "true"
有什么想法吗?请? 谢谢,彼得
答案 0 :(得分:1)
对我来说,问题是我的达尔文版本是57(OSX 10.12.6)
npm install uws#to me is uws@8.14.1,thit has my darwin version
现在将已编译的版本复制到您的操作系统
cp node_modules / uws / uws_darwin_57.node node_modules / socketcluster-server / node_modules / uws /
答案 1 :(得分:0)
已经很晚了,我今天才真正了解docker-compose
和Stack Overflow,所以请原谅我,如果我在这里犯了一些非常明显的错误,但是:
docker run yourimage
,包括任何一个命令。那运行得好吗?docker-compose
中,为什么data_chat-ws
服务的图片为node:6.7-slim
?不应该是您构建的图像,即image: chat-ws
?这是我开始调试的地方:首先确保您实际上能够运行图像,不要使用所有docker-compose
内容,只有当它运行正常时,才将其添加到docker-compose.yml
。为帮助检查您是否可以实际运行容器,请查看其官方文档中的示例here(向下滚动到“如何使用此图像&#39;页面的一部分”。