This example can be easily adapted for all available PHP versions available as RPM (5.3.3 in RHEL-6, 5.4.16 in RHEL-7, 5.4.16 and 5.5.6 in RHSCL 1.2 or using a third party repository).

I use this Dockerfile:

FROM centos:6
RUN yum -y update && yum clean all
RUN yum -y install php-fpm php-mbstring php-mysql php-gd && yum clean all
RUN sed -e 's/' \
        -e '/allowed_clients/d' \
        -e '/catch_workers_output/s/^;//' \
        -e '/error_log/d' \
        -i /etc/php-fpm.d/www.conf
RUN mkdir -p /var/www/html
ENTRYPOINT /usr/sbin/php-fpm --nodaemonize


  • yum install allow to use the available packages, extension list need to be adapted to suite your need
Scripts directory:
  • the /var/www/html directory used here need to be adapted, according to your scripts location

Changes applied to the fpm pool configuration:

  • listen = 9000 to listen on all interfaces
  • remove listen.allowed_clients to allow connection from outside the container
  • remove error_log to use global error recording
  • enable catch_workers_ouput to catch the pool error in the main server

Creation of the container:

docker build -t fpm53 .

Launching the container:

docker run -v /var/www/html:/var/www/html -p fpm53

Notice :  /var/www/html directory and port 9000 (in container) mapped to port 9003 (in host)


Even if I'm a fervent supporter of Software Collections, when missing, we have a very simple way to get an operational PHP version 5.3.3 on a recent distribution (tested on Fedora 20) with the benefit of using official repository.