![](/img/trans.png)
[英]How to install php-redis extension using the official PHP Docker image approach?
[英]Missing php-redis repository in docker debian stretch image
我缺少包含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
文件中缺少一个资源。 我错过了什么回购? 我也想知道我如何找到来源的来源,所以类似的情况再次发生,我可以弄清楚而不是问另一个问题。
我查看了此页面 - 但找不到任何看起来应该将其添加到我的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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.