docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

Any ways to add some extra extensions ?

Open apsylone opened this issue 9 years ago • 1 comments

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 :-)

apsylone avatar Aug 18 '16 20:08 apsylone

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.

iteman avatar Aug 19 '16 05:08 iteman