docker
As a web developer we all had the problem of php version between two projects. Docker is a quick and simple answer. It allows to have many containers running with their own configuration.

I first searched on internet to find a good Dockerfile to run a Laravel project, but I didn’t like the way it was done or the versions used didn’t match what I needed. This is why I decided to do mine, it’s good to understand how containers work.

So what I needed was:

  • apache 2.4
  • php 5.6
  • sql drivers for postgresql
  • php libs (mcrypt …)

This was quite simple to do. Everything was available on a debian jessie. I also added mysql drivers.

The last part was the manipulation of the project directory. As the goal was to set a dev environment the files couldn’t be in the container. So sharing the directory was the solution I’ve selected: we can code and see the result without having to generate the container again and again.

Just follow the steps on my github to try: Docker-Apache-2.4-Php5.6-for-Laravel

The last point was the administration of the logs, they are redirected to the stderr and stdout so we juste have to do a docker logs my-container.

This Dockerfile is working like a charm with Laravel 5, but also with 5.1 5.2 and Lumen.

An other article will discuss the usage of Docker to make the front part: apache server with a reverse proxy.

Some explications will come, I just don’t have enough time now.

Enjoy!

Hits: 410

*