Docker PHP7 CLI Debian Buster 如何安装软件包 php-imagick?
Docker PHP7 CLI Debian Buster how to install package php-imagick?
我有一个 PHP-CLI Docker image of Debian Buster and would like to install php-imagick 包,但有命令:
Docker 文件:
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-CLI Docker image of Debian Buster and would like to install php-imagick 包,但有命令:
Docker 文件:
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