TL; DR
The image that you posted could not be built, correcting the errors I got, I came to this image that does work:
FROM php:5.6-fpm
RUN apt-get update && \
apt-get install -y --no-install-recommends \
zlib1g-dev && \
docker-php-ext-configure pdo_mysql --with-mysql=mysqlnd && \
docker-php-ext-configure mysqli --with-mysqli=mysqlnd && \
docker-php-ext-install mysqli pdo pdo_mysql zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
NOTE: The last two lines are to try to reduce the image space.
Long version
I tried to build the image you posted and I get the following error:
+ cd /usr/src/php/ext/mysqlnd
+ phpize
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
If we look at the documentation of MySQL Native Driver we see that it says:
5.4.0 The MySQL Native Driver is now the default for all MySQL extensions (ie, mysql, mysqli and PDO_MYSQL).
Passing mysqlnd to the configuration is now optional.
And further down on the same page it says:
MySQL database extensions must be configured to
use the MySQL Client Library. In order to use the
Native MySQL driver, PHP needs to be compiled specifying
that the MySQL database extensions are compiled with the
Support for the MySQL Native Driver.
And it also indicates how to compile the extensions, that is, we can remove the package mysqlnd
and we need to indicate that the extensions mysqli
and pdo_mysql
are compiled with the MySQL Native Drive.
For the latter you can use docker-php-ext-configure
.
If I add the necessary lines to configure the packages, then I get the error that it does not find zlib
to compile the zip extension:
checking libzip... no
checking for the location of zlib... configure: error: zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
So it would be lacking to install the package zlib1g-dev
to compile zip
. Adding the installation of the package and then cleaning the packages, I get to the image above.