PHP Dockerfiles with additional libraries (mainly for our needs)
Move to the folder containing the desired Dockerfile.
Build the image
docker build -t <dockertag> .
Create a shell script called php<version>.sh with this content :
#!/bin/bash
docker run --rm --interactive --tty \
--workdir /usr/src/myapp \
--volume $PWD:/usr/src/myapp \
--user $(id -u):$(id -g) \
<dockertag> php "$@"
All images are available at : https://hub.docker.com/r/ihneo/php
You can pull all images with the command :
docker pull ihneo/php:<dockertag>
7.1-cli-alpine7.2-cli-alpine7.3-cli-alpine7.4-cli-alpine8.0-cli-alpine8.1-cli-alpine8.2-cli-alpine8.3-cli-alpine8.4-cli-alpine8.5-cli-alpine,latest7.1-fpm-alpine7.2-fpm-alpine7.3-fpm-alpine7.4-fpm-alpine8.0-fpm-alpine8.1-fpm-alpine8.2-fpm-alpine8.3-fpm-alpine8.4-fpm-alpine8.5-fpm-alpine
#!/bin/bash
docker run --rm --interactive --tty \
--workdir /usr/src/myapp \
--volume $PWD:/usr/src/myapp \
--user $(id -u):$(id -g) \
ihneo/php:<dockertag> php "$@"
Composer is also available in all images
An example to use the docker image as a composer binary :
#!/bin/bash
docker run --rm --interactive --tty \
--env COMPOSER_HOME=/tmp/composer/config \
--env COMPOSER_CACHE_DIR=/tmp/composer/cache \
--workdir /app \
--volume $PWD:/app \
--volume ${COMPOSER_HOME:-$HOME/.config/composer}:/tmp/composer/config \
--volume ${COMPOSER_CACHE_DIR:-$HOME/.cache/composer}:/tmp/composer/cache \
--user $(id -u):$(id -g) \
ihneo/php:<dockertag> composer "$@"