大家讲道理2017-04-26 09:04:26
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!
PHPz2017-04-26 09:04:26
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.