I want to build my PHP-FPM image with php-redis
extension based on the official PHP Docker image, for example, using this Dockerfile: php:5.6-fpm.
The docs
Slightly revised version of starikovs and skyred answers for current version of the docker image. Tested on php:5-fpm-alpine
# install phpredis extension
ENV PHPREDIS_VERSION 2.2.8
ADD https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz /tmp/redis.tar.gz
RUN tar xzf /tmp/redis.tar.gz -C /tmp \
&& mkdir -p /usr/src/php/ext \
&& mv /tmp/phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis \
&& echo 'redis' >> /usr/src/php-available-exts \
&& docker-php-ext-install redis \
&& rm -rf /usr/src/php/ext/redis