can't run php site using docker on prouduction host

I only have this issue on a Digital Ocean box. On my laptop I can see the website. On production I get 500 when trying to curl my site.
if i hit the gateway of that docker from the outside world, i can see my site. but that’s not a solution. i would like to point my dns to the ip of the host and not the docker gateway.


  • Upgrading gcc in dockerfile
  • Docker private registry - Method not allowed 405
  • Docker and service clusters
  • Setup notification for private docker registry
  • docker: cannot map two container ports to one host port
  • Selenium web console not showing active sessions when run inside docker container
  • FROM phusion/baseimage:0.9.15
    ENV HOME /root
    RUN /etc/my_init.d/
    CMD ["/sbin/my_init"]
    # Nginx-PHP Installation
    RUN apt-get update
    RUN apt-get install -y vim curl wget build-essential python-software-properties
    RUN add-apt-repository -y ppa:ondrej/php5
    RUN add-apt-repository -y ppa:nginx/stable
    RUN apt-get update
    RUN apt-get install -y --force-yes php5-cli php5-fpm php5-mysql php5-pgsql php5-sqlite php5-curl\
                           php5-gd php5-mcrypt php5-intl php5-imap php5-tidy
    RUN sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php5/fpm/php.ini
    RUN sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php5/cli/php.ini
    RUN apt-get install -y nginx
    RUN echo "daemon off;" >> /etc/nginx/nginx.conf
    RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
    RUN sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php5/fpm/php.ini
    RUN mkdir -p        /var/www
    ADD build/default   /etc/nginx/sites-available/default
    RUN mkdir           /etc/service/nginx
    ADD build/  /etc/service/nginx/run
    RUN chmod +x        /etc/service/nginx/run
    RUN mkdir           /etc/service/phpfpm
    ADD build/ /etc/service/phpfpm/run
    RUN chmod +x        /etc/service/phpfpm/run
    EXPOSE 80
    # End Nginx-PHP
    RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

    build and run

    docker build -t donate-home .
    docker run --name donate-home -d -p 3001:80 -v $(pwd)/www:/var/www:rw donate-home /sbin/my_init --enable-insecure-key

    on production host

    curl -i localhost:3001

    HTTP/1.1 500 Internal Server Error

    docker logs donate-home

    *** Installing insecure SSH key for user root                                                                                                                                          │····························
    Creating directory /root/.ssh...                                                                                                                                                       │····························
    Editing /root/.ssh/authorized_keys...                                                                                                                                                  │····························
    Success: insecure key has been added to /root/.ssh/authorized_keys                                                                                                                     │····························
    +------------------------------------------------------------------------------+                                                                                                       │····························
    | Insecure SSH key installed                                                   |                                                                                                       │····························
    |                                                                              |                                                                                                       │····························
    | DO NOT expose port 22 on the Internet unless you know what you are doing!    |                                                                                                       │····························
    |                                                                              |                                                                                                       │····························
    | Use the private key below to connect with user root                         |                                                                                                        │····························
    +------------------------------------------------------------------------------+                                                                                                       │····························
    -----BEGIN RSA PRIVATE KEY-----                                                                                                                                                        │····························
    <content of private key>
    -----END RSA PRIVATE KEY-----                                                                                                                                                          │····························
    *** Running /etc/my_init.d/                                                                                                                                │····························
    *** Running /etc/rc.local...                                                                                                                                                           │····························
    *** Booting runit daemon...                                                                                                                                                            │····························
    *** Runit started as PID 17                                                                                                                                                            │····························
    [13-Feb-2015 22:13:12] NOTICE: fpm is running, pid 31                                                                                                                                  │····························
    [13-Feb-2015 22:13:12] NOTICE: ready to handle connections

  • Docker - How to disable PHP ext / modules
  • Why is Varnish redirecting as 301?
  • What is a sidekick container?
  • How can I set up a mysql slave in Docker?
  • Docker data-only container on AWS ECS
  • docker exec is missing
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.