我在Docker集装箱上安装了Nginx,并试图将其照样操作:
docker run -i -t -p 80:80 mydockerimage /usr/sbin/nginx
问题是,Nginx公司的工作方式是,最初的过程立即导致Nginx总公司和一些工人,然后放弃。 由于Docker只看PID原指挥部,该集装箱随后停下来。
我如何阻止集装箱停泊? 我需要能够告诉它要遵守第一个儿童进程,或停止Nginx最初的退出进程。
我在Docker集装箱上安装了Nginx,并试图将其照样操作:
docker run -i -t -p 80:80 mydockerimage /usr/sbin/nginx
问题是,Nginx公司的工作方式是,最初的过程立即导致Nginx总公司和一些工人,然后放弃。 由于Docker只看PID原指挥部,该集装箱随后停下来。
我如何阻止集装箱停泊? 我需要能够告诉它要遵守第一个儿童进程,或停止Nginx最初的退出进程。
nginx
, 如同所有行为良好的方案一样,可以不进行自我垄断。
http://wiki.nginx.org/CoreModule” rel=“noreferer” http://wiki.nginx.org/CoreModule。
为了扩大对Charles Duffy的回答,Nginx使用daemon off
指令在地下操作。 如果在配置档案中说明这一点不方便,我们就可以直接将其具体指明在指挥线上。 这使得通过改变指挥线的杠杆,很容易以 de(地下)的方式运行,并直接转向生产模式(后方)。
1. 草原:
nginx -g daemon off;
具有以下背景:
nginx
在约翰的答复中扩大,您也可使用Dockerfile
CMD
。 指挥(如果你想要在没有额外动力的情况下自行启动)
CMD ["nginx", "-g", "daemon off;"]
Just FYI, as of this (22 October 20) 所有方面都有:
CMD ["nginx", "-g", "daemon off;"]
e.g. https://github.com/nginox/bcker-nginx/blob/23a990403d6dbe102bf2c72b2ab2f6a239e940e33/cmainline/enc/
将这一指挥权添加到Dockerfile,可能会使其失去作用:
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
加上Tomer和Charles的答复,
2. 采用切入点在多克集装箱的地面上操作原gin子:
ENTRYPOINT nginx -g daemon off;
并非直接相关,而是由多个指挥机关代行:
ENTRYPOINT /bin/bash -x /myscripts/myscript.sh && nginx -g daemon off;
For all who come here trying to run a nginx image in a docker container, that will run as a service
既然没有完整的Dockerfile,这里是我解决问题的全文Dockerfile
。
尼斯和工作。 感谢这里的所有答复,以便解决最后的原始问题。
FROM ubuntu:18.04
MAINTAINER stackoverfloguy "stackoverfloguy@foo.com"
RUN apt-get update -y
RUN apt-get install net-tools nginx ufw sudo -y
RUN adduser --disabled-password --gecos docker
RUN adduser docker sudo
RUN echo %sudo ALL=(ALL) NOPASSWD:ALL >> /etc/sudoers
USER docker
RUN sudo ufw default allow incoming
RUN sudo rm /etc/nginx/nginx.conf
RUN sudo rm /etc/nginx/sites-available/default
RUN sudo rm /var/www/html/index.nginx-debian.html
VOLUME /var/log
VOLUME /usr/share/nginx/html
VOLUME /etc/nginx
VOLUME /var/run
COPY conf/nginx.conf /etc/nginx/nginx.conf
COPY content/* /var/www/html/
COPY Dockerfile /var/www/html
COPY start.sh /etc/nginx/start.sh
RUN sudo chmod +x /etc/nginx/start.sh
RUN sudo chmod -R 777 /var/www/html
EXPOSE 80
EXPOSE 443
ENTRYPOINT sudo nginx -c /etc/nginx/nginx.conf -g daemon off;
并且用:
docker run -p 80:80 -p 443:443 -dit
在杜克·布赖恩官方国家地理信息小组影像的正式照会中,该声明:
If you add a custom CMD in the Dockerfile, be sure to include
-g daemon off;
in the CMD in order for nginx to stay in the foreground, so that Docker can track the process properly (otherwise your container will stop immediately after starting)!
这使我想去除《千年发展目标》[]可能首先阻止这一问题发生吗?
在新版本的公共集装箱中,现在没有文字,因此没有必要增加指挥/立点。
另见:。
For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...
How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks
i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...
Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...
I ve just installed Zend Studio 7.0.2 on my Linux-Ubuntu 9.10 system. There were no problems during the installation but when I try to create a new project, the New Project form hangs when I click ...
I am running valgrind as follows:- /usr/local/bin/valgrind "process_name" After excecution its giving me following error ==21731== ==21731== Warning: Can t execute setuid/setgid executable: ==...
I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...
Is there anything other than DDD that will draw diagrams of my data structures like DDD does that runs on Linux? ddd is okay and runs, just kind of has an old klunky feeling to it, just wanted to ...