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.

  • Docker private trusted registry
  • Docker Push not able to push images to docker hub, it keep retrying
  • Cannot access ports on MacOSX host from within docker container
  • Escaping double curly braces in Ansible
  • Running Lightttpd in Docker: ulimits not honored
  • Docker Compose Expose Spark Worker UI Ports Dynamically to Host When Scaling
  • 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?

  • Extend Existing Docker Image
  • SQL Server Linux Docker image keeps exiting
  • How can I tell in Dockerfile which comand I want to execute when input “docker run” command?
  • can we update docker default configure?
  • docker swarm access service
  • Why does Docker run so many processes to map ports though to my application?
  • 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.