Generic PHP images, based on alpine, with useful extensions.
10K+
The purpose of this is to provide a generic PHP base image that can be shared across projects. It won't matter if you're running Magento, Laravel, Wordpress, or Craft CMS, etc. You'll have a consistent base image that provides a number of tools built in, and sensible php extensions.
These images are designed to be used in production, as well as in a staging/local environments.
Images available:
Images with xdebug preinstalled & enabled:
Deprecated tags (only alpine is being actively developed):
docker-compose build
You will need to reconfigure to use the root user, then switch back afterwards to the app user.
FROM ashsmith/php:7.2-fpm-alpine
USER root
RUN apk add myawesomepackage
USER app:app
My goal is to provide some commonly used extensions, and speed up build times by not needing to recompile PHP multiple times.
Composer, of course!
app user instead of root?TL;DR; Security.
Read up on it here: Processes in containers should not run as root
docker run ashsmith/php:7.2-fpm-alpine -v $(pwd):/var/www/html -p 9000:9000 --name myawesomephpapp
Or if you like to use docker-compose:
version: "3.0"
services:
cli:
image: ashsmith/php:7.2-cli-alpine
volumes:
- ./src:/var/www/html:delegated
phpfpm:
image: ashsmith/php:7.2-fpm-alpine
volumes:
- ./src:/var/www/html:delegated
nginx:
image: ashsmith/nginx:latest-phpfpm
environment:
- FPM_HOST=phpfpm
links:
- phpfpm
ports:
- 80:80
volumes:
- ./src:/var/www/html:delegated
Then:
docker-compose up -d
Want to run one of commands?
docker-compose run --rm cli composer install
opcache is enabled by default!
For local development I recommend mounting a new php .ini file to explicitly disable opcache.
Content type
Image
Digest
Size
127.9 MB
Last updated
over 6 years ago
docker pull ashsmith/php:7.3-fpm