Public | Automated Build

Last pushed: 2 years ago
Short Description
My php dev environment.
Full Description


PHP dev image based on official php-image with composer and phpcs.
This image also include nodejs, npm, bower, git sometimes used by composer's pre/post install scripts.

Datetime is set by default to Europe/Paris.

How to use this image

Run a single PHP script:

For many simple, single file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a PHP script by using the PHP Docker image directly:

$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp loliee/docker-php:5.6 php your-script.php

Define shell functions

Some functions to put in your .zshrc or bashrc.


function phpd(){
  if  [[ $1 == /* ]]; then MOUNT=$(dirname "$1"); else MOUNT=$PWD; fi
  eval "$(docker-machine env dev)"
  docker run -ti --rm --name php56-"$USER"-"$(gdate +%s%N)" -v "$MOUNT":"$MOUNT" -w "$MOUNT" "$PHPD" php "$@"
  unset MOUNT

function composerd() {
  local args="$*"
  local name="$PHPD-composer-$args"
  if hash gdate &>/dev/null; then
    name="$name"-"$(gdate +%s%N)"
    name="$name"-"$(gdate +%sN)"
  # shellcheck disable=SC2001
  name="$(echo "$name" | sed "s/[^a-zA-Z0-9_.-]/_/")"
  if  [[ $1 == /* ]]; then mount=$(dirname "$1"); else mount=$PWD; fi
  docker run -ti --rm --name "$name" -v "$mount":"$mount" -w "$mount" loliee/docker-"$PHPD" php -n \
    -dtimezone=Europe/Paris \ \ \
    -dmemory_limit=-1 /usr/local/bin/composer.phar "$@"
  unset mount name

You should be able to run the following command to execute php in an ephemere container:

phpd -v


Use composer in HTTP mode (more easy to cache with a proxy) and use a auth.json file for private repo.

To add a token in a repo:

composer config your_github_token 

Build image with OCI8

git clone
cd docker-php/5.6/oci8

Download and from oracle website and put zip files in docker-php/5.6/oci8/instantclient directory.

docker build -t loliee/docker-php:5.6-oci8


Setup with the following extensions:

  • bcmath
  • bz2
  • ctype
  • curl
  • exif
  • fileinfo
  • ftp
  • gd
  • gettext
  • hash
  • iconv
  • imap
  • intl
  • json
  • mbstring
  • mcrypt
  • mongodb-1.1.2
  • mysql
  • mysqli
  • oci8 (Optional, require custom build)
  • odbc
  • opcache
  • pcntl
  • pdo
  • pdo_mysql
  • pdo_pgsql
  • pdo_sqlite
  • pgsql
  • phar
  • redis
  • simplexml
  • soap
  • sockets
  • sysvmsg
  • sysvsem
  • sysvshm
  • tidy
  • tokenizer
  • xdebug-2.3.3
  • xml
  • xmlreader
  • xmlrpc
  • xmlwriter
  • xslt
  • zip
Docker Pull Command
Source Repository