Skip to content

debug211/docker-phpfpm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Pulls

Table of Contents

Installation

docker pull romeoz/docker-phpfpm

or other versions (7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4 or 5.3):

docker pull romeoz/docker-phpfpm:7.1

Alternately you can build the image yourself.

git clone https://github.com/romeoz/docker-phpfpm.git
cd docker-phpfpm
docker build -t="$USER/docker-phpfpm" .

Quick Start

Run the application container:

docker run --name app -d -p 9000:9000 romeoz/docker-phpfpm

The simplest way to login to the app container is to use the docker exec command to attach a new process to the running container.

docker exec -it app bash

Adding PHP-extension

You can use one of two choices to install the required php-extensions:

  1. docker exec -it app bash -c 'apt-get update && apt-get install php-mongo && rm -rf /var/lib/apt/lists/*'

  2. Create your container on based the current. Сontents Dockerfile:

FROM romeoz/docker-phpfpm:5.6

RUN apt-get update \
    && apt-get install -y php-mongo \
    && rm -rf /var/lib/apt/lists/* 

WORKDIR /var/www/app/

EXPOSE 9000

CMD ["/usr/sbin/php-fpm5.6"]

Next step,

docker build -t php-5.6 .
docker run --name app -d -p 9090:9000 php-5.6

See installed php-extension: docker exec -it app php -m

PHP-extension "Mcrypt" was REMOVED in PHP 7.2. Use Sodium or OpenSSL

Logging

All the logs are forwarded to stdout and sterr. You have use the command docker logs.

docker logs app

####Split the logs

You can then simply split the stdout & stderr of the container by piping the separate streams and send them to files:

docker logs app > stdout.log 2>stderr.log
cat stdout.log
cat stderr.log

or split stdout and error to host stdout:

docker logs app > -
docker logs app 2> -

####Rotate logs

Create the file /etc/logrotate.d/docker-containers with the following text inside:

/var/lib/docker/containers/*/*.log {
    rotate 31
    daily
    nocompress
    missingok
    notifempty
    copytruncate
}

Optionally, you can replace nocompress to compress and change the number of days.

Out of the box

  • Ubuntu 12.04, 14.04, 16.04 or 18.04 LTS
  • PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2 or 7.3
  • Composer (package manager)

Environment depends on the version of PHP.

License

PHP-FPM docker image is open-sourced software licensed under the MIT license

About

PHP-FPM container image which can be linked to other containers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 91.8%
  • Shell 8.2%