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.

  • Golang Mac OSX build for Docker machine
  • Prevent Docker-Engine restart during apt-get upgrade
  • Enable Postgis extension Postgres in Dockerfile
  • How to refresh a container links
  • ffmpeg stream on docker
  • Docker file to call PS1 file with parameters
  • 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?

  • Change boot2docker memory assignment
  • Docker container transfer using LFS properties
  • configuration management in Docker Containers
  • Docker passing in a variable into an shell script running git clone
  • How to expose Spark Driver behind dockerized Apache Zeppelin?
  • How to specify write access to volume with fig
  • 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.