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 the current PHP 7 version of the docker image (tested on php:7.0.8-fpm-alpine
and php:7.0.8-alpine
).
Uses the newly released 3.0
version (June 2016) for PHP 7.
ENV PHPREDIS_VERSION 3.0.0
RUN mkdir -p /usr/src/php/ext/redis \
&& curl -L https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
&& echo 'redis' >> /usr/src/php-available-exts \
&& docker-php-ext-install redis