docker build 自动启动服务不生效
我想大声告诉你
我想大声告诉你 2017-04-26 09:02:26
0
3
783

docker buill -t imagename .
CMD 自动开启 nginx 失败

我想大声告诉你
我想大声告诉你

reply all(3)
阿神

buill?

大家讲道理

Generally speaking, automatically starting certain processes is usually managed by supervisor. Please google for specific usage.

If you want something simpler, you can try:
(1) CMD ["nginx", "-g", "daemon off;"], mainly used when docker run is required -d xxx;CMD ["nginx", "-g", "daemon off;"], 主要用在需要 docker run -d xxx 的情况;
(2)或写一个脚本 run.sh, 然后 CMD ["path/to/run.sh"](2) or write a script run.sh, and then CMD ["path/to/run.sh"]

Because you didn’t provide any other specific information, I don’t know what your nginx will return after failure, so I can only analyze it here.
I am a citizen or above, and I mainly want to hear what is said later. Pass!

PHPzhong

Add CMD nginx to the Dockerfile. Note that if there are multiple CMDs, only the last one is valid.
Build to generate the image and then run it.
docker run -d image. That’s it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template