How to install php-redis extension using the official PHP Docker image approach?

前端 未结 11 1012
Happy的楠姐
Happy的楠姐 2021-01-30 02:21

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

11条回答
  •  鱼传尺愫
    2021-01-30 02:56

    This works for alpine images:

    RUN set -xe \
        && apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \
        && pecl install -o -f redis  \
        && echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini \
        && rm -rf /usr/share/php \
        && rm -rf /tmp/* \
        && apk del  .phpize-deps
    

    Edit: Added missing backslash

提交回复
热议问题