'Unable to install Redis extension in Docker php fpm-alpine image

This is my Dockerfile

FROM php:8.1-fpm-alpine3.15
RUN apk update; \
    apk upgrade;

RUN apk add libzip-dev
RUN docker-php-ext-install zip

RUN apk add --no-cache libpng libpng-dev && docker-php-ext-install gd && apk del libpng-dev

RUN docker-php-ext-install mysqli pdo pdo_mysql

RUN apk add --no-cache pcre-dev $PHPIZE_DEPS && pecl install redis && docker-php-ext-enable redis.so

I receive back this error during building process

No releases available for package "pecl.php.net/redis"



Solution 1:[1]

Check out this github issue: https://github.com/laradock/laradock/issues/1661 where someone had a similar issue in a different case. There are a couple of possible workarounds there.

Boils down to your connection possibly not being able to retrieve the package to you needing to do a couple of extra steps such as updating the channels before you can search for/install redis.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Azarro