Docker image based on PHP official images with working webserver (Nginx/Apache2.4) and dev settings.
10K+
Use instead: https://hub.docker.com/r/bmeme/php
These are Docker images based on Debian/Jessie with a working webserver, ready to be used for php development. They are all built starting from official PHP repository as you can see looking our Dockerfile (see previous paragraph).
Dockerfile links7.2.14-fpm-nginx, 7.2, 7.2-fpm-nginx, 7 or latest Dockerfile7.2.14-apache, 7.2-apache Dockerfile7.2.3-fpm-nginx Dockerfile7.2.3-apache Dockerfile7.1.11-fpm-nginx, 7.1, 7.1-fpm-nginx Dockerfile7.0.24-fpm-nginx, 7.0, 7.0-fpm-nginx Dockerfile7.0.24-apache, 7.0-apache Dockerfile5.6.31-apache2, 5.6, 5.6-apacheDockerfile5.5.38-apache2, 5.5, 5.5-apacheDockerfilewget, git, vim, zip and unzip, cron with basic configuration, rsyslog to manage system logging, mysql-client, ansible.supervisordexplained laterdocker-php-ext-configure/docker-php-ext-install):
bcmathpdo_mysqljsoniconvmcrypt (from php 7.2.x version installed via pecl install)gdzipmbstringsocketsintloauthigbinary (from php-dev:7.2.14*, installed via pecl install)redis (from php-dev:7.2.14*, installed via pecl install)mhsendmail binary (see: https://www.lullabot.com/articles/debugging-php-email-with-mailhog)Starting your PHP environment is really simple:
$ docker run --name some-name -p 8080:80 -d bmeme/php-dev:tag
where some-name is the name you want to assign to your container and tag is the tag specifying the image version you want. See the list above for relevant tags. Pointing your browser to http://localhost:8080 you'll see the complete phpinfo.
Obviously you can change the local binding port matching your needs.
FROM php-dev:7.0.24-fpm-nginx
COPY src/ /var/www/html/
Where src/ is the directory containing all your PHP code.
Then, run the commands to build and run the Docker image:
$ docker build -t my-php-dev-app .
$ docker run -d --name my-running-app my-php-dev-app
If you want to customise PHP settings look at the following paragraph before to COPY a php.ini file into the container during the build process.
PHP_MEMORY_LIMIT, default at 512MPHP_MAX_EXECUTION_TIME, default at 60PHP_ERROR_LOG, default at /tmp/php_errors.logUPLOAD_MAX_FILESIZE, default at 20MPOST_MAX_SIZE default at 20MXDEBUG_IDEKEYdefault at PHPSTORM$ docker run --name some-name --link some-db-image:some-tag -d bmeme/php-dev:tag
Follow instructions in database image repository to correctly match available environments.
docker-composeversion: '3.1'
services:
php-dev:
image: php-dev:7.0.24-fpm-nginx
ports:
- 8080:80
- 8443:443
- 9001:9001 # xdebug port
environment: # just as example
- UPLOAD_MAX_FILESIZE=100M
- POST_MAX_SIZE=100M
restart: always
postgres:
image: postgres:9.6
environment:
- POSTGRES_PASSWORD: example
restart: always
Run docker-compose -f php-dev.yml up, wait for it to initialize completely, and visit http://localhost:8080, or http://host-ip:8080 (as appropriate).
The php-dev images come basically in two "main" flavour:
php-fpm engine with nginx embeddedapache2 embeddedWe consider the "php-fpm-nginx" flavour as default.
This image is using supervisor to start at the same time:
This project is a contribution of Bmeme :: The Digital Factory.
This library is actually maintained by Daniele Piaggesi.
Really thanks to Francesco Pesenti aka Pex of Psegno for 5.6.x image and some other fixes and tests.
Any other contribution will be really appreciated.
Content type
Image
Digest
Size
326.4 MB
Last updated
over 7 years ago
docker pull bmeme/php-dev