Setting up a PHP decent development environment

After years of spaghetti code (I’m Italian, I do really know what spaghetti are) I’m trying to set up a decent php development environment.

This is my battleplan:

  • where are apps installed using apt-get within Dockerfile?
  • Forward Ports from boot2docker using the Vagrant Docker provider
  • Restarting a docker that runs supervisord programs keeps pid files and causes error at restart
  • How to set Java heap size (Xms/Xmx) inside Docker container?
  • Error adding a node to docker swarm
  • Containers dependency with etcd keys
    1. install git and docker on my laptop;
    2. create a docker virtual enviroment as much similar as possible to
      the production LAMP (shared) server;
    3. use sshfs to mount the docker VE web server root directory on my laptop;
    4. on the laptop, init a git repository inside the mount point;
    5. use my favourite ide (aptana studio) to create a php project in the mount point directory;
    6. test the code pointing a browser to docker VE ip;
    7. set up a bitbucket account to automatically deploy git commits on production server.

    What do you think about? Any chance it could work?


  • Is it necessary to use Docker in Java?
  • Two apt-get arguments to a docker run command doesn't work
  • Apache Kafka on Docker - stops after few hundred pools
  • Connect Nginx Docker container to 16 workers
  • docker container hanging when run dotnet new
  • Re-running docker-compose in Windows says network configuration changed
  • One Solution collect form web for “Setting up a PHP decent development environment”

    I suggest using the official php language docker image:

    This enables you to create an image that packages your php code, rather than having to map volumes at run-time.

    Example 1 (with Dockerfile)

    ├── Dockerfile
    └── src
        └── index.php


    FROM php:5.6-apache
    COPY src/ /var/www/html/

    Script that builds a new container image and launches it:

    docker build -t my-php-app .
    docker run -it --rm --name my-running-app -p 8080:80 my-php-app

    Apache is configured to listen on port 8080

    Example 2 (without Dockerfile)

    The php image can also be run without a docker file. Just provide a mapping to the source code locally:

    docker run -it --rm --name my-apache-php-app -v "$(pwd)/src":/var/www/html -p 8080:80 php:5.6-apache
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.