我有Debian Buster的PHP-CLI Docker image,想安装php-imagick软件包,但使用以下命令:
Dockerfile:
RUN apt-get install -y php-imagick
我收到一个错误:
Package php-imagick 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-imagick' has no installation candidate
运行之前:
RUN apt-get update -y && apt-get upgrade -y
没有帮助。
为什么没有php-imagick的候选软件包?
如何为此PHP Docker image安装和启用imagick扩展?
Dockerfile复制问题:
FROM php:7.3-buster
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y php-imagick
构建命令
docker build --tag testimage .
最佳答案
除非您有充分的理由不这样做,否则使用https://deb.sury.org/中的软件包可能是一个好主意。以下内容似乎起作用:
FROM debian:buster-slim
USER root
# Get Debian up-to-date
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y git \
mariadb-client wget curl \
ca-certificates lsb-release apt-transport-https gnupg bsdmainutils
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee -a /etc/apt/sources.list.d/php.list \
&& curl https://packages.sury.org/php/apt.gpg | apt-key add - \
&& apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y php7.3 php7.3-common php7.3-cli \
php7.3-mysql php7.3-curl php7.3-xml php7.3-mbstring \
php7.3-intl php7.3-redis php7.3-zip \
php7.3-imagick supervisor
关于php - Docker PHP7 CLI Debian Buster如何安装软件包php-imagick?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57438387/