Docker box with Apache/PHP5 on CentOS7 + shared directories with the host used for the projects
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Docker box with Apache v2.4 and PHP v5.4 on CentOS v7. Before you close the tab, wondering why PHP 5.4? Because it was created for maintaining legacy code. That doesn't mean that you can't change the docker file to install any PHP version you wish.


  • Ideal as development environment! Edit code on the host, run in the docker box. Preserve file ownership and permissions (644) of the code
  • with additional tweaking it can be easily changed as a container for legacy applications on production servers
  • All the configuration files and code are accessible from the host machine
  • Apache logs are also available on the host machine
  • Works on
  • It can work in parallel with another web server on the host machine via reverse proxy, hence the port 8080. If you don't need this feature, change the port to 80.
  • Works with any php framework: Laravel, Drupal, CodeIgniter, Magento...

More info: Tutorial home page


The idea behind this project was to create an containerized copy of a production enviroment for the developers. This image is the first and probably the most important step in acomplishing that task. It lets the developers code on the host while seamlessly executing the code in docker while solving the issues with file ownership and permissions. No Samba/NFS tweaks are necessary on both the host and docker box.


Install docker and docker-compose

git clone in your project directory

Start the following script to add the current user to docker group


Then execute the following script to pull the image from Docker Hub and start docker-compose


Once you execute ./ for the first time three directories will be created:

./www/html - this is where your code goes

./www/logs - Apache logs

./www/conf - Put your virtual host configurations here

Other scripts:

docker-compose.yml - configuration file - stops the containers - ssh to the box (If you need super user privileges in the box, execute: sudo su. No password needed) - executes in the box on each ssh. Very useful for further tweaking.

The /image_scripts directory contains files used to create the docker image.