Docker Community Forums

Share and learn in the Docker community.

How to add php modules to a container


(Oshani) #1

Hi All,

I have a container with mediawiki ( synctree/mediawiki ). It came with several php modules installed and I would like to add another one ( php-ldap ). Just going into the container and installing php5-ldap with apt-get doesn’t work because in installs the module files into the wrong place, and besides, it doesn’t feel like the right way to go.

So can someone point me to the right procedure for doing that?

Docker version 17.05.0-ce, build 89658be

Many thanks,

Oren Shani


(Sam) #2

sadly no magic here

you either do what you did, fixing the install location ( I assume a google search will tell you how, or the current image instructions will tell you how), then docker commit to save the container to a new image
OR
create a dockerfile, with the existing image FROM
add the new module, correcting where it installs

after either, you use the new image to start new containers


(Raj Chaudhuri) #3

You should build your own image, based on the synctree/mediawiki image, which in turn is based on the official php:5.6-apache image.

The official php image comes with some scripts such as docker-php-ext-install for these situations. Take a look at the documentation here (https://hub.docker.com/_/php/) under the heading “How to install more PHP extensions”.