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:

  • How can I expose kubernetes services running within docker?
  • build context for docker image very large
  • Unable to create spring boot initialzr project (A org.springframework.web.client.HttpClientErrorException exception has occurred)
  • How can I provide application config to my .NET Core Web API services running in docker containers?
  • mysql_install_db in Docker container returns error
  • error retrieving template Job(deis-router@.service) from Registry in ec2 deis installation
  • 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
    

  • Gunicorn is stuck on docker run command with a Flask Application
  • Docker volume not used with Redis (mount does show up with inspect)
  • Import images from kitematic to boot2docker
  • Setting up rabbitMQ on docker with python
  • How to write parameterized Bash alias for Docker command
  • docker volume plugin not properly detected by docker engin
  • One Solution collect form web for “Running Supervisord on Ubuntu in Docker”

    You should:

    1. Run supervisord in the foreground use -n option.
    2. Use ENTRYPOINT instead of CMD in Dockerfile.
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.