Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker容器不能run起来,请问有碰到的吗? #1543

Closed
longxianlin opened this issue Oct 18, 2017 · 9 comments
Closed

docker容器不能run起来,请问有碰到的吗? #1543

longxianlin opened this issue Oct 18, 2017 · 9 comments

Comments

@longxianlin
Copy link

FROM daocloud.io/node:latest
RUN mkdir -p /data/www
WORKDIR /data/www
COPY . .
RUN npm install --registry=https://registry.npm.taobao.org
EXPOSE 7001
CMD npm start

不用docker,npm start正常

@atian25
Copy link
Member

atian25 commented Oct 18, 2017

报错信息?

@longxianlin
Copy link
Author

npm start是在容器里面的后台运行。
用npm run dev让egg跑在前台,就能启动docker了

@popomore
Copy link
Member

popomore commented Oct 18, 2017

参考这个 #1431 (comment)

你拷贝代码也不对啊

@atian25
Copy link
Member

atian25 commented Oct 18, 2017

npm start 里面如果是 egg-scripts start --daemon 的话就是后台运行,如果想前台就干掉 --daemon

@longxianlin
Copy link
Author

FROM node:8.0.0-alpine
速度太慢了
RUN apk --update add tzdata
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
&& echo "Asia/Shanghai" > /etc/timezone
&& apk del tzdata
会报错

npm install最好放在外面

我是有jenkins自动启动编译容器。
还没有用刀k8s

@popomore
Copy link
Member

docker 用 aliyun 加速呗,不然肯定慢

@thonatos
Copy link
Member

速度慢的问题,配个阿里云镜像的加速器解决喽~

备注一下:

node:8.0.0-alpine,sticky 下 egg-socket-io 会有问题,如果没特殊要求换高版本吧

@atian25
Copy link
Member

atian25 commented Oct 24, 2017

所以现在没问题了?先关了

@atian25 atian25 closed this as completed Oct 24, 2017
@longxianlin
Copy link
Author

没有问题了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants