create web app with php and docker

I have the following DOCKERFILE:

FROM php
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/marcosh/webinthemiddle.git
EXPOSE 80
CMD php -S localhost:80 webinthemiddle/index.php

that I would like to use to create a very basic app with php.

  • How to change the 'Registry' value which shows from 'docker info'
  • boot2docker bash command line is very slow
  • logstash on docker: set multiple pipeline
  • Chronos does not run job
  • Docker seems to ignore DOCKER_HOST and other vars set from `eval $(docker-machine env)`
  • docker enterprise solution?
  • I build the image using sudo docker build -t marcosh/webinthemiddle .
    and then I tried running the container using

    sudo docker run -d -P marcosh/webinthemiddle
    

    or

    sudo docker run -d -P marcosh/webinthemiddle php -S localhost:80 webinthemiddle/index.php
    

    Then I checked with sudo docker ps to which port was mapped the port 80 of the container and browser to localhost:#PORT#, but I found nothing there…

    What am I doing wrong?

  • Different file owner inside Docker container and in host machine
  • Build docker image from rhel6.5 image
  • “docker-compose build” is showing me help text when I specify a file
  • Stopping stubborn container?
  • Step by Step Setup Guide to Neo4j Mazerunner in Windows
  • How to refer to an internal docker registry?
  • One Solution collect form web for “create web app with php and docker”

    Two things will be helpful for you to debug this:

    1. When debugging problems like this, start by running the container in the foreground interactively and with a TTY (-i and -t respectively). Your command would be something like sudo docker run -i -t -P marcosh/webinthemiddle php -S localhost:80 webinthemiddle/index.php.
    2. Next, in the Docker container world, localhost is local to the container (not your host). Since the container is only listening on localhost, requests from other IP addresses (such as your host) won’t get to the socket. You will want to listen on 0.0.0.0:80.
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.