Giter VIP home page Giter VIP logo

docker-phpfpm's Introduction

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

docker-phpfpm's People

Contributors

romeoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker-phpfpm's Issues

romeoz/docker-phpfpm:7.2

Hey Romeoz,

First of all, thanks for this pretty awesome image thats easy to use.

I have been using this for a while now, suddenly I am getting the below error, below are the logs

_Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpg-wks-server_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]_

Complete log:
Step 1/15 : FROM romeoz/docker-phpfpm:7.2
---> b2d87bccd3f7
Step 2/15 : ENV OS_LOCALE="en_US.UTF-8" DEBIAN_FRONTEND=noninteractive
---> Using cache
---> 1c37b14c2937
Step 3/15 : RUN apt-get update --fix-missing && apt-get install -y locales && locale-gen ${OS_LOCALE}
---> Using cache
---> 03c7e3efe0ea
Step 4/15 : ENV LANG=${OS_LOCALE} LANGUAGE=${OS_LOCALE} LC_ALL=${OS_LOCALE} NGINX_CONF_DIR=/etc/nginx
---> Using cache
---> f541f5f88f80
Step 5/15 : COPY ./supervisord.conf /etc/supervisor/conf.d/
---> Using cache
---> 4a85f59e694b
Step 6/15 : COPY . /var/www/app/
---> ca5243f3bca6
Step 7/15 : RUN BUILD_DEPS='software-properties-common wget gnupg' && dpkg-reconfigure locales && apt-get install --no-install-recommends -y $BUILD_DEPS && wget -O - http://nginx.org/keys/nginx_signing.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=noninteractive apt-key add - && echo "deb http://nginx.org/packages/ubuntu/ bionic nginx" | tee -a /etc/apt/sources.list && echo "deb-src http://nginx.org/packages/ubuntu/ bionic nginx" | tee -a /etc/apt/sources.list && apt-get update && apt-get install -y nginx && rm -rf ${NGINX_CONF_DIR}/sites-enabled/* ${NGINX_CONF_DIR}/sites-available/* && apt-get install -y supervisor && mkdir -p /var/log/supervisor && chown www-data:www-data /var/www/app/ -Rf && apt-get purge -y --auto-remove $BUILD_DEPS && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
---> Running in b9ea40a1030c
�[91mGenerating locales (this might take a while)...
�[0m�[91m en_US�[0m�[91m.UTF-8�[0m�[91m...�[0m�[91m done
�[0m�[91mGeneration complete.
�[0mReading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
dirmngr distro-info-data gir1.2-glib-2.0 gnupg-l10n gnupg-utils gpg
gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm iso-codes
libapt-inst2.0 libassuan0 libdbus-1-3 libgirepository-1.0-1 libglib2.0-0
libksba8 libmpdec2 libnpth0 libpython3-stdlib libpython3.6-minimal
libpython3.6-stdlib libreadline7 lsb-release pinentry-curses
python-apt-common python3 python3-apt python3-dbus python3-gi
python3-minimal python3-software-properties python3.6 python3.6-minimal
readline-common
Suggested packages:
dbus-user-session libpam-systemd pinentry-gnome3 tor parcimonie xloadimage
scdaemon isoquery lsb pinentry-doc python3-doc python3-tk python3-venv
python3-apt-dbg python-apt-doc python-dbus-doc python3-dbus-dbg
python3.6-venv python3.6-doc binutils binfmt-support readline-doc
Recommended packages:
dbus libglib2.0-data shared-mime-info xdg-user-dirs unattended-upgrades
The following NEW packages will be installed:
dirmngr distro-info-data gir1.2-glib-2.0 gnupg gnupg-l10n gnupg-utils gpg
gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm iso-codes
libapt-inst2.0 libassuan0 libdbus-1-3 libgirepository-1.0-1 libglib2.0-0
libksba8 libmpdec2 libnpth0 libpython3-stdlib libpython3.6-minimal
libpython3.6-stdlib libreadline7 lsb-release pinentry-curses
python-apt-common python3 python3-apt python3-dbus python3-gi
python3-minimal python3-software-properties python3.6 python3.6-minimal
readline-common software-properties-common wget
0 upgraded, 39 newly installed, 0 to remove and 71 not upgraded.
Need to get 11.5 MB of archives.
After this operation, 56.6 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-minimal amd64 3.6.9-118.04ubuntu1.1 [533 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6-minimal amd64 3.6.9-1
18.04ubuntu1.1 [1,610 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-minimal amd64 3.6.7-118.04 [23.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmpdec2 amd64 2.4.2-1ubuntu1 [84.1 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 readline-common all 7.0-3 [52.9 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline7 amd64 7.0-3 [124 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-stdlib amd64 3.6.9-1
18.04ubuntu1.1 [1,711 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6 amd64 3.6.9-118.04ubuntu1.1 [203 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3-stdlib amd64 3.6.7-1
18.04 [7,240 B]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3 amd64 3.6.7-1~18.04 [47.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 distro-info-data all 0.37ubuntu0.7 [4,676 B]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libglib2.0-0 amd64 2.56.4-0ubuntu0.18.04.6 [1,171 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgirepository-1.0-1 amd64 1.56.1-1 [82.0 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-glib-2.0 amd64 1.56.1-1 [131 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libapt-inst2.0 amd64 1.6.12ubuntu0.1 [54.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdbus-1-3 amd64 1.12.2-1ubuntu1.2 [175 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 lsb-release all 9.20170808ubuntu1 [11.0 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic/main amd64 python3-dbus amd64 1.2.6-1 [89.9 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-gi amd64 3.26.1-2ubuntu1 [153 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 iso-codes all 3.79-1 [2,565 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python-apt-common all 1.6.5ubuntu0.3 [16.8 kB]
Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-apt amd64 1.6.5ubuntu0.3 [149 kB]
Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 wget amd64 1.19.4-1ubuntu2.2 [316 kB]
Get:24 http://archive.ubuntu.com/ubuntu bionic/main amd64 libassuan0 amd64 2.5.1-2 [35.0 kB]
Ign:25 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpgconf amd64 2.2.4-1ubuntu1.2
Get:26 http://archive.ubuntu.com/ubuntu bionic/main amd64 libksba8 amd64 1.3.5-2 [92.6 kB]
Get:27 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnpth0 amd64 1.5-3 [7,668 B]
Ign:28 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 dirmngr amd64 2.2.4-1ubuntu1.2
Ign:29 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg-l10n all 2.2.4-1ubuntu1.2
Ign:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg-utils amd64 2.2.4-1ubuntu1.2
Ign:31 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg amd64 2.2.4-1ubuntu1.2
Get:32 http://archive.ubuntu.com/ubuntu bionic/main amd64 pinentry-curses amd64 1.1.0-1 [35.8 kB]
Ign:33 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-agent amd64 2.2.4-1ubuntu1.2
Ign:34 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-wks-client amd64 2.2.4-1ubuntu1.2
Ign:35 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-wks-server amd64 2.2.4-1ubuntu1.2
Ign:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpgsm amd64 2.2.4-1ubuntu1.2
Ign:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg amd64 2.2.4-1ubuntu1.2
Get:38 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-software-properties all 0.96.24.32.14 [23.9 kB]
Get:39 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 software-properties-common all 0.96.24.32.14 [10.1 kB]
Err:25 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gpgconf amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:28 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 dirmngr amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:29 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg-l10n all 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:30 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg-utils amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:31 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gpg amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:33 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-agent amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:34 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-wks-client amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:35 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-wks-server amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:36 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gpgsm amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Err:37 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg amd64 2.2.4-1ubuntu1.2
404 Not Found [IP: 91.189.88.152 80]
Fetched 9,519 kB in 3s (3,489 kB/s)
�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpgconf_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/dirmngr_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gnupg-l10n_2.2.4-1ubuntu1.2_all.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gnupg-utils_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpg_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpg-agent_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpg-wks-client_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]�[0m�[91m
�[0m�[91mE�[0m�[91m: �[0m�[91mFailed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpg-wks-server_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gpgsm_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gnupg2/gnupg_2.2.4-1ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
�[0mThe command '/bin/sh -c BUILD_DEPS='software-properties-common wget gnupg' && dpkg-reconfigure locales && apt-get install --no-install-recommends -y $BUILD_DEPS && wget -O - http://nginx.org/keys/nginx_signing.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=noninteractive apt-key add - && echo "deb http://nginx.org/packages/ubuntu/ bionic nginx" | tee -a /etc/apt/sources.list && echo "deb-src http://nginx.org/packages/ubuntu/ bionic nginx" | tee -a /etc/apt/sources.list && apt-get update && apt-get install -y nginx && rm -rf ${NGINX_CONF_DIR}/sites-enabled/* ${NGINX_CONF_DIR}/sites-available/* && apt-get install -y supervisor && mkdir -p /var/log/supervisor && chown www-data:www-data /var/www/app/ -Rf && apt-get purge -y --auto-remove $BUILD_DEPS && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log' returned a non-zero code: 100

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.