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
CMD php -S localhost:80 webinthemiddle/index.php

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

  • How can I setup Docker container with individual IP address on EC2 instance?
  • AWS latency spike during fix hours
  • Slow connection to mysql running in docker
  • All external DNS queries fail from within docker container
  • Error with Restcomm docker image when call
  • boot2docker on windows missing apt-get / package manager
  • 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


    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?

  • Docker + Nginx deleted folder issue
  • Windows container can't ping Ubuntu container in Swarm
  • Downloading images from custom registry with go-dockerclient hangs
  • entrypoint file not found
  • Haskell Stack Image Container Execute On Docker run
  • How to figure out, what slows down docker?
  • 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
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.