The base image used in this custom php image is from ubuntu:16.04
's build from docker hub.
Default configuration for user and group:
user = www-data
group = www-data
The image contains the following pre-installed php extensions as per the version:
- PHP_VERSION-mcrypt
- PHP_VERSION-gd
- PHP_VERSION-mysql
- PHP_VERSION-pgsql
- PHP_VERSION-sqlite3
- PHP_VERSION-imap
- PHP_VERSION-mbstring
- PHP_VERSION-xml
- PHP_VERSION-curl
- PHP_VERSION-bcmath
- PHP_VERSION-mongo
- PHP_VERSION-intl
- PHP_VERSION-soap
- php-memcached
- php-memcache
- php-redis
- php-apcu
In addition, helpful packages for php development are pre-installed.
- composer
- curl
- git
- zip
- unzip
For performance optimization, there's a separate Dockerfile.debug
file for building php image with xdebug installed.
Basic usage can be found on php
's official docker hub repository.
The image exposes port 9000
for outside access.
Notes:
-
While the image is building, it will run the following command:
mkdir /root/.ssh && echo "StrictHostKeyChecking no " > /root/.ssh/config
This command will allow you to mount your host's ssh keys if your app will use a private repository package. You can ignore this if you're not planning to use a private repository, it's safe!
docker build -t $vendor/docker-php:$version .
docker build -f Dockerfile.debug -t $vendor/docker-php:xdebug-$version .
docker run --rm -it $vendor/docker-php:$version php -v