手机版
你好,游客 登录 注册
背景:
阅读新闻

PostgreSQL——在Docker中的Ubuntu上运行Supervisord

[日期:2015-12-13] 来源:Linux社区  作者:Linux [字体:大 中 小]

我试图使用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 http://www.linuxidc.com/Linux/2014-05/101787.htm

PostgreSQL缓存详述 http://www.linuxidc.com/Linux/2013-07/87778.htm

Windows平台编译 PostgreSQL http://www.linuxidc.com/Linux/2013-05/85114.htm

Ubuntu下LAPP(Linux+Apache+PostgreSQL+PHP)环境的配置与安装 http://www.linuxidc.com/Linux/2013-04/83564.htm

Ubuntu上的phppgAdmin安装及配置 http://www.linuxidc.com/Linux/2011-08/40520.htm

CentOS平台下安装PostgreSQL9.3 http://www.linuxidc.com/Linux/2014-05/101723.htm

PostgreSQL配置Streaming Replication集群 http://www.linuxidc.com/Linux/2014-05/101724.htm

如何在CentOS 7/6.5/6.4 下安装PostgreSQL 9.3 与 phpPgAdmin  http://www.linuxidc.com/Linux/2014-12/110108.htm

------------------------------------华丽丽的分割线------------------------------------

PostgreSQL 的详细介绍:请点这里
PostgreSQL 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-12/126173.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款