docker-images
docker-images copied to clipboard
Any ways to add some extra extensions ?
Hi Mentors :-)
I would like to know if there is any ways to add some extras PHP5 extensions ? In my case, I would like to add memcached.
Thanks for your anwser :-)
The APP_INIT environment variable can be used for this.
First, write a script as the following:
docker/app-init:
#!/bin/bash
apt-get update
apt-get -y upgrade
apt-get -y install php5-gd
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
exit $RETVAL
fi
...
Second, specify the script as the value of the APP_INIT_SCRIPT environment variable as the following:
docker-compose.yml:
version: '2'
services:
app:
image: "phpmentors/symfony-app:php55"
...
environment:
APP_INIT_SCRIPT: "docker/app-init"
...
If the value of the APP_INIT_SCRIPT environment variable is relative path, /var/app will be added to the beginning of the value.