phpdockerredisdebian-stretch

Missing php-redis repository in docker debian stretch image


I'm missing the repository that includes the php-redis package. Inside my debian 9/stretch docker container I run the following:

root@dcc82d674095 [19:36:46] [/var/www/html]
-> # apt-get install php-redis
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-redis is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php-redis' has no installation candidate

However if I run apt search php-redis I can see that it is "there":

root@dcc82d674095 [19:41:18] [/var/www/html]
-> # apt search php-redis
Sorting... Done
Full Text Search... Done
php-redis/stable,stable 3.1.1-1 amd64
  (none)

My /etc/apt/sources.list looks like this:

deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian stretch-updates main

My guess is that I'm missing a resource in that sources.list file. What repo am I missing? I'd also like to know how I find where the source is from so a similar situation happens again I can figure it out rather than asking another question.

I looked at this page - but couldn't figure out any link that looked like I should add it to my sources.list file. (That's just my assumption of what is going wrong).

https://packages.debian.org/source/stretch/php-redis


EDIT:

While I am still interested in finding an answer to my question, I found a work around by installing the package through pecl. In my docker file I added the following:

# printf statement mocks answering the prompts from the pecl install
RUN printf "\n \n" | pecl install redis && docker-php-ext-enable redis

Solution

  • If you use php:7.1-fpm-stretch container, all php-*** packages are blocked for installation, see detail here: https://github.com/docker-library/php/issues/713

    This leads to the following documentation in their github repository:

    Which explains the following:

    The proper solution to this error is to either use FROM debian:XXX and install Debian's PHP packages directly, or to use docker-php-ext-install, pecl, and/or phpize to install the necessary additional extensions and utilities.