简体   繁体   中英

Running Supervisord on Ubuntu in Docker

I'm trying to use supervisor to start nginx and postgresql on boot of a docker container. Using the following Dockerfile and supervisord.conf files, the aforementioned applications start but moments later stop. Does anyone know what could be wrong? There are no error messages to stderr or system log files.

Dockerfile:

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:

[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

You should:

  1. Run supervisord in the foreground use -n option .
  2. Use ENTRYPOINT instead of CMD in Dockerfile .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM