Public Repository

Last pushed: 2 years ago
Short Description
PHP-FPM, built on Phusion/baseimage. Includes php5-cli for cron, php5-mysqlnd, php5-curl.
Full Description

GitHub Repository:

###github.com/addiscent/php-fpm-docker

Typical Usage With Docker-compose

Configuration Files

Place any desired typical PHP-FPM-related configuration files into a sub-directory of the "docker-compose" home directory, e.g., ./conf/php.ini, and/or ./conf/php-fpm.conf. The example code fragment below maps those config files into the container's configuration at run-time. If it is necessary to revise the config files after starting the container, the container must be restarted, ("docker-compose up -d'), so the PHP-FPM server re-reads the new configuration.

Website Or Applications Files

For this example, place website-applications files into a sub-directory of the "docker-compose" home directory, e.g., ./www/public/*. The example code fragment below maps the website files into the container's public www tree at run-time. If the content of the website files is revised, the new or revised files are automatically fetched the next time the appropriate website page file is accessed, there is no need to restart the container.

Crontab File

If execution of a crontab file is required, place it into a sub-directory of the "docker-compose" home directory, e.g., ./conf/etc-cron.d-tab-for-phpfpm.txt. In the example code fragment below, the file will be named "phpservermon" when mapped into the container's /etc/cron.d directory at container run-time. Format the file as a typical crontab. Note the crontab file, (./conf/etc-cron.d-tab-for-phpfpm.txt), must have attributes of "mode 600" and owner:group of root:root, or the cron job will not run.

Example docker-compose.yml fragment

  php:
      image: raddiscentis/php-fpm:0.0.1
      volumes:
          - ./conf/php-fpm.conf:/etc/php5/fpm/php-fpm.conf
          - ./conf/www.conf:/etc/php5/fpm/conf.d/www.conf
          - ./conf/php.ini:/etc/php5/fpm/php.ini
          - ./www/public:/var/www/public
          - ./conf/etc-cron.d-tab-for-phpfpm.txt:/etc/cron.d/phpservermon
      links:
            - db:mysqlpsm

Dockerfile:

  FROM phusion/baseimage:0.9.16

  MAINTAINER Rex Addiscentis <raddiscentis@addiscent.com>

  CMD ["/sbin/my_init"]

  RUN apt-get update && apt-get install -y php5-fpm php5-cli php5-curl php5-mysqlnd

  RUN sed -i '/^cgi.fix_pathinfo /c cgi.fix_pathinfo = 0;' /etc/php5/fpm/php.ini

  RUN sed -i '/^default_charset /c default_charset = "UTF-8"' /etc/php5/fpm/php.ini

  RUN sed -i '/^listen /c listen = 9000' /etc/php5/fpm/pool.d/www.conf

  RUN sed -i '/^daemonize /c daemonize = no' /etc/php5/fpm/php-fpm.conf

  RUN mkdir -p /etc/service/php-fpm

  ADD start.sh /etc/service/php-fpm/run

  RUN chmod +x /etc/service/php-fpm/run

  EXPOSE 9000

  RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

##Etc
Licensed under Apache 2.0 License.

Copyright © 2015 Rex Addiscentis, raddiscentis@addiscent.com

Docker Pull Command
Owner
raddiscentis