php - docker debian 拉伸(stretch)镜像中缺少 php-redis 存储库

标签 php docker redis debian-stretch

我缺少包含 php-redis 包的存储库。在我的 debian 9/stretch docker 容器中,我运行以下命令:

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

但是,如果我运行apt search php-redis,我可以看到它“在那里”:

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)

我的/etc/apt/sources.list看起来像这样:

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

我的猜测是我在该sources.list文件中缺少一个资源。我缺少什么 repo 协议(protocol)?我还想知道我是如何找到来源的,这样类似的情况再次发生我就可以弄清楚而不是问另一个问题。

我查看了此页面 - 但找不到任何看起来应该将其添加到我的 sources.list 文件中的链接。 (这只是我对问题所在的假设)。

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

<小时/>

编辑:

虽然我仍然有兴趣找到问题的答案,但我找到了通过 pecl 安装软件包的解决方法。在我的 docker 文件中,我添加了以下内容:

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

最佳答案

如果您使用 php:7.1-fpm-stretch 容器,所有 php-*** 软件包都会被阻止安装,详细信息请参见:https://github.com/docker-library/php/issues/713

这会导致其 github 存储库中出现以下文档:

这解释了以下内容:

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.

关于php - docker debian 拉伸(stretch)镜像中缺少 php-redis 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52672382/

相关文章:

php - 如何在发票已支付且订单状态为处理中时取消订单?

php - Paypal IPN $自定义变量不适用于 PHP

docker - 如何在本地访问 nginx 入口?

caching - 使用 Redis 缓存关系数据库查询结果的典型方法有哪些?

java - 完成java测试代码后有什么方法可以回滚redis数据吗?

asynchronous - redisAsyncContext 中的 ev

php - 如何在Codeigniter View 中使用HTML标签?

phpbrew 安装特定 php 版本构建失败(make : *** [sapi/cli/php] ERROR 1)

docker - 为生产和开发创建单独的 docker-compose 配置

docker - 如何增加 docker 容器的大小限制?