PHP Containers for local development
50K+
Docker container for local PHP development :
Extended from official PHP image for Docker.
This image comes with the following tools installed :
vnvsa/symfony only)vnvsa/wordpress only)grunt-cli (vnvsa/magento only)Caution
This image is intended for **local development only**, we do not ensure production optimizations and securities measures.
8.5-cli, 8.5-cli-trixie8.5-cli-bookworm8.5-fpm, 8.5-fpm-trixie8.5-fpm-bookworm8.4-cli, 8.4-cli-trixie8.4-cli-bookworm8.4-cli-bullseye8.4-fpm, 8.4-fpm-trixie8.4-fpm-bookworm8.4-fpm-bullseye8.3-cli, 8.3-cli-trixie8.3-cli-bookworm8.3-cli-bullseye8.3-fpm, 8.3-fpm-trixie8.3-fpm-bookworm8.3-fpm-bullseye8.2-cli, 8.2-cli-trixie8.2-cli-bookworm8.2-cli-bullseye8.2-cli-buster8.2-fpm, 8.2-fpm-trixie8.2-fpm-bookworm8.2-fpm-bullseye8.2-fpm-buster8.1-cli, 8.1-cli-trixie8.1-cli-bookworm8.1-cli-bullseye8.1-cli-buster8.1-fpm, 8.1-fpm-trixie8.1-fpm-bookworm8.1-fpm-bullseye8.1-fpm-buster8.0-cli, 8.0-cli-bullseye8.0-cli-buster8.0-fpm, 8.0-fpm-bullseye8.0-fpm-buster7.4-cli, 7.4-cli-bullseye7.4-cli-buster7.4-fpm, 7.4-fpm-bullseye7.4-fpm-busterThese tags are available on all images. Eg:
vnvsa/magento:8.5-cli-trixie,vnvsa/wordpress:8.5-fpm-bookworm
8.5-cli, 8.5-cli-trixie, 8.5-cli-trixie-composer2, 8.5-cli-trixie-composer2.98.5-cli-bookworm, 8.5-cli-bookworm-composer2, 8.5-cli-bookworm-composer2.98.5-fpm, 8.5-fpm-trixie,8.5-fpm-trixie-composer2, 8.5-fpm-trixie-composer2.98.5-fpm-bookworm,8.5-fpm-bookworm-composer2, 8.5-fpm-bookworm-composer2.98.4-cli, 8.4-cli-trixie, 8.4-cli-trixie-composer2, 8.4-cli-trixie-composer2.98.4-cli-bookworm, 8.4-cli-bookworm-composer2, 8.4-cli-bookworm-composer2.98.4-cli-bullseye, 8.4-cli-bullseye-composer2, 8.4-cli-bullseye-composer2.98.4-cli-bullseye-composer2.98.4-fpm, 8.4-fpm-trixie,8.4-fpm-trixie-composer2, 8.4-fpm-trixie-composer2.98.4-fpm-bookworm,8.4-fpm-bookworm-composer2, 8.4-fpm-bookworm-composer2.98.4-fpm-bullseye,8.4-fpm-bullseye-composer2, 8.4-fpm-bullseye-composer2.98.4-fpm-bullseye-composer2.98.3-cli, 8.3-cli-trixie, 8.3-cli-trixie-composer2, 8.3-cli-trixie-composer2.98.3-cli-bookworm, 8.3-cli-bookworm-composer2, 8.3-cli-bookworm-composer2.98.3-cli-bullseye, 8.3-cli-bullseye-composer2, 8.3-cli-bullseye-composer2.98.3-cli-bullseye-composer2.98.3-fpm, 8.3-fpm-trixie,8.3-fpm-trixie-composer2, 8.3-fpm-trixie-composer2.98.3-fpm-bookworm,8.3-fpm-bookworm-composer2, 8.3-fpm-bookworm-composer2.98.3-fpm-bullseye,8.3-fpm-bullseye-composer2, 8.3-fpm-bullseye-composer2.98.3-fpm-bullseye-composer2.98.2-cli, 8.2-cli-bookworm, 8.2-cli-bookworm-composer2, 8.2-cli-bookworm-composer2.28.2-cli-bullseye, 8.2-cli-bullseye-composer2, 8.2-cli-bullseye-composer2.28.2-cli-buster, 8.2-cli-buster-composer2, 8.2-cli-buster-composer2.28.2-cli-bullseye-composer2.28.2-cli-buster-composer2.28.2-fpm, 8.2-fpm-bookworm,8.2-fpm-bookworm-composer2, 8.2-fpm-bookworm-composer2.28.2-fpm-bullseye,8.2-fpm-bullseye-composer2, 8.2-fpm-bullseye-composer2.28.2-fpm-buster,8.2-fpm-buster-composer2, 8.2-fpm-buster-composer2.28.2-fpm-bullseye-composer2.28.2-fpm-buster-composer2.28.1-cli, 8.1-cli-bookworm, 8.1-cli-bookworm-composer2, 8.1-cli-bookworm-composer2.28.1-cli-bullseye, 8.1-cli-bullseye-composer2, 8.1-cli-bullseye-composer2.28.1-cli-buster, 8.1-cli-buster-composer2, 8.1-cli-buster-composer2.28.1-cli-bullseye-composer2.28.1-cli-buster-composer2.28.1-fpm, 8.1-fpm-bookworm,8.1-fpm-bookworm-composer2, 8.1-fpm-bookworm-composer2.28.1-fpm-bullseye,8.1-fpm-bullseye-composer2, 8.1-fpm-bullseye-composer2.28.1-fpm-buster,8.1-fpm-buster-composer2, 8.1-fpm-buster-composer2.28.1-fpm-bullseye-composer2.28.1-fpm-buster-composer2.28.0-cli, 8.0-cli-bullseye, 8.0-cli-bullseye-composer28.0-cli-buster, 8.0-cli-buster-composer28.0-cli-bullseye-composer2.28.0-cli-buster-composer2.28.0-fpm, 8.0-fpm-bullseye, 8.0-fpm-bullseye-composer28.0-fpm-buster, 8.0-fpm-buster-composer28.0-fpm-bullseye-composer2.28.0-fpm-buster-composer2.27.4-cli, 7.4-cli-bullseye, 7.4-cli-bullseye-composer27.4-cli-buster, 7.4-cli-buster-composer27.4-cli-bullseye-composer2.27.4-cli-buster-composer2.27.4-fpm, 7.4-fpm-bullseye, 7.4-fpm-bullseye-composer27.4-fpm-buster, 7.4-fpm-buster-composer27.4-fpm-bullseye-composer2.27.4-fpm-buster-composer2.2The composer tags are available on magento images only. Eg:
vnvsa/magento:8.4-cli-bullseye-composer2.6
vnvsa/php, vnvsa/magento and vnvsa/wordpressstages:
- test
php:unit_tests:
stage: test
image: vnvsa/php:8.5-cli
variables:
XDEBUG_MODE: coverage
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
before_script:
- composer install --optimize-autoloader --no-interaction --no-progress
script:
- vendor/bin/phpunit --colors=never --log-junit phpunit-report.xml --coverage-text --coverage-cobertura=coverage.cobertura.xml
artifacts:
reports:
junit: phpunit-report.xml
coverage_report:
coverage_format: cobertura
path: coverage.cobertura.xml
when: always
cache:
key:
files:
- composer.lock
paths:
- ./vendor
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "webide"'
vnvsa/symfonystages:
- test
php:unit_tests:
stage: test
image: vnvsa/symfony:8.5-cli
variables:
XDEBUG_MODE: coverage
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
before_script:
- composer install --optimize-autoloader --no-interaction --no-progress
script:
- vendor/bin/simple-phpunit --colors=never --log-junit phpunit-report.xml --coverage-text --coverage-cobertura=coverage.cobertura.xml
artifacts:
reports:
junit: phpunit-report.xml
coverage_report:
coverage_format: cobertura
path: coverage.cobertura.xml
when: always
cache:
key:
files:
- composer.lock
paths:
- ./vendor
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "webide"'
Dockerfilevnvsa/php# Optionally define the time zone
# ARG TZ="UTC"
FROM vnvsa/php:8.5-cli
# Reset to "root" user
USER root
# Install something
RUN apt-get install -yqq vim \
&& pie install phpredis/phpredis
COPY . /app # or mount a folder directly to /app
# Restore "dev" user
USER dev
CMD [ "php", "./your-script.php" ]
vnvsa/symfonyFROM vnvsa/symfony:8.5-fpm
# Reset to "root" user
USER root
# Install something
RUN apt-get install -yqq vim \
&& pie install phpredis/phpredis
COPY . /app # or mount a folder directly to /app
# Restore "symfony" user
USER symfony
vnvsa/magento# Optionally define the time zone
# ARG TZ="UTC"
FROM vnvsa/magento:8.5-fpm
# Reset to "root" user
USER root
# Install something
RUN apt-get install -yqq vim \
&& pie install phpredis/phpredis
COPY . /app # or mount a folder directly to /app
# Restore "magento" user
USER magento
vnvsa/wordpress# Optionally define the time zone
# ARG TZ="UTC"
FROM vnvsa/wordpress:8.5-fpm
# Reset to "root" user
USER root
# Install something
RUN apt-get install -yqq vim \
&& pie install phpredis/phpredis
COPY . /app # or mount a folder directly to /app
# Restore "wordpress" user
USER wordpress
docker-compose.{yml,yaml} stackvnvsa/php, vnvsa/magento and vnvsa/wordpressservices:
# PHP FPM needs a web server to serve requests
php-fpm:
# Replace the image with the variant you need for your project (eg. magento, wordpress)
image: vnvsa/php:8.5-fpm
entrypoint: ./docker/php/entrypoint.sh
user: dev
tty: true
environment:
- TERM=xterm-256color
volumes:
- ./:/app
# NGINX or Apache
web:
image: nginx:latest
ports:
- "8000:80"
volumes:
- ./:/app:delegated
# A configuration
- ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php-fpm
with the following site.conf for NGINX
server {
listen 80 default_server;
server_name localhost;
root /app/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
# Must be the name of the "php" service defined in docker-compose stack. Eg: "php-fpm"
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Your application is now available at
http://localhost:8000
vnvsa/symfonySince the vnvsa/symfony comes with symfony-cli tool, it use the bundled webserver from symfony "server:start" command to serve requests with HTTPS support, so we don't need another webserver like NGINX or Apache.
services:
php:
image: vnvsa/symfony:8.5-fpm
user: symfony
tty: true
environment:
- TERM=xterm-256color
ports:
- 8000:8000
volumes:
- ./:/app
Your application is now available at
https://localhost:8000.
This image run as the following user by default depending on the base image :
vnvsa/php run as devvnvsa/symfony run as symfonyvnvsa/magento run as magentovnvsa/wordpress run as wordpressThere is only one base volume configured in all images and it's the /app directory.
Note
**Only for `fpm` images variant !**
The default exposed port is 9000 (from php-fpm process).
An additional port is available for vnvsa/symfony images : 8000.
Because it use the symfony-cli to serve requests with HTTPS support by default.
By default, images allow connections from all networks interfaces/IPs (using SYMFONY_ALLOW_ALL_IP=true environment variable).
If you don't want that, you can set this environment variable SYMFONY_ALLOW_ALL_IP=false and add this option to symfony-cli server:start command in your entrypoint.sh :
/usr/bin/symfony "server:start" --use-gzip --listen-ip="192.168.0.1"
These are the default PHP INI configuration values used for the image.
| Setting | Default value |
|---|---|
date.timezone | Europe/Zurich |
memory_limit | -1 |
opcache.enable | 1 |
opcache.fast_shutdown | 1 |
opcache.interned_strings_buffer | 16 |
opcache.max_accelerated_files | 10000 |
opcache.max_wasted_percentage | 10 |
opcache.memory_consumption | 192 |
opcache.revalidate_freq | 0 |
opcache.validate_timestamps | 1 |
short_open_tag (Symfony only) | Off |
These are the extensions installed and enabled by default :
bcmathbrotliexifgd (with freetype, webp and xpm support)imagickintlopcachepcntlpdopdo_mysqlpdo_pgsqlmysqli (Magento & Wordpress only)pgsqlsocketszipxdebugftp (Magento only)soap (Magento only)xsl (Magento only)zstdphp:<version>-cliUse this for your CLI applications or in CI/CD for running tests.
php:<version>-fpmUse this for your web applications (when you need to serve requests with HTTP/HTTPS from a webserver).
Pull requests, bug reports, and feature requests are welcome.
MIT License. See the LICENSE file.
Content type
Image
Digest
sha256:2fe0fddbd…
Size
487.1 MB
Last updated
3 days ago
docker pull vnvsa/php:8.5-cli-trixie