今天,我尝试为默认的php docker容器安装一些PHP扩展。我的dockerfile看起来像这样:
FROM php:7.2-cli
#remove apt install restriction
RUN rm /etc/apt/preferences.d/no-debian-php
#Install php-addons
RUN apt-get update \
&& apt-get install -y php-zip php-xml php-json php-mbstring
COPY . /
WORKDIR /
默认情况下,我有2个错误。
Err:1 http://deb.debian.org/debian延长发行 解决“ deb.debian.org”的临时故障 无法解析“ archive.ubuntu.com”
AND
E:软件包“ php-json”没有安装候选对象
答案 0 :(得分:0)
解决方案是:
E:软件包“ php-json”没有安装候选对象
在dockerfile中此行固定
RUN rm /etc/apt/preferences.d/no-debian-php
AND
Err:1 http://deb.debian.org/debian延长发行 解决“ deb.debian.org”的临时故障 无法解析“ archive.ubuntu.com”
已修复
Uncomment the following line in /etc/default/docker
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"