我试图使用supervisor启动nginx和PostgreSQL,在docker container的boot上。使用下面的Dockerfile和supervisord.conf文件,上述的应用程序启动,但片刻之后停止。哪里错了?stderr或系统日志文件中没有错误消息。
Dockerfile:
1. [代码] [text]
FROM Ubuntu:14.04
RUN mkdir -p /var/www /var/pgsql/data /var/log/pgsql /var/log/nginx
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY nginx.conf /etc/nginx/sites-enabled/default
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install curl wget supervisor postgresql postgresql-contrib libpq-dev llvm gcc g++ Python3-pip python2.7 pytho
n2.7-dev python-pip git nginx nodejs openjdk-7-jdk build-essential
RUN apt-get -y clean all
EXPOSE 80 8000 8080
CMD ["/usr/bin/supervisord"]
supervisord.conf:
2. [代码] [text]
[supervisord]
nodaemon=true
[program:nginx]
command=/bin/bash -c "exec /usr/sbin/nginx -DFOREGROUND"
stdout_logfile=/var/log/nginx/%(program_name)s.log
stderr_logfile=/var/log/nginx/%(program_name)s.log
[program:postgresql]
command=/bin/bash -c "exec /usr/lib/postgresql/9.3/bin/postgres -D /var/pgsql/data"
stdout_logfile=/var/log/pgsql/%(program_name)s.log
stderr_logfile=/var/log/pgsql/%(program_name)s.log
--------------------------------------解决方案--------------------------------------------
你应该:
使用-n选项在前台运行supervisord。
在Dockerfile中使用ENTRYPOINT,而不是CMD。
------------------------------------华丽丽的分割线------------------------------------
CentOS 6.3环境下yum安装PostgreSQL 9.3
Ubuntu下LAPP(Linux+Apache+PostgreSQL+PHP)环境的配置与安装
PostgreSQL配置Streaming Replication集群
如何在CentOS 7/6.5/6.4 下安装PostgreSQL 9.3 与 phpPgAdmin
------------------------------------华丽丽的分割线------------------------------------