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

前端 未结 11 1045
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:45

    Based on @starikovs answer. I added a variable for docker style.

    # install phpredis extension
    ENV PHPREDIS_VERSION 2.2.7
    
    RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz \
        && tar xfz /tmp/redis.tar.gz \
        && rm -r /tmp/redis.tar.gz \
        && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis \
        && docker-php-ext-install redis
    

提交回复
热议问题