Nils Zenker
Nils Zenker

Reputation: 709

Docker PHP Addons E: Package 'php-json' has no installation candidate

Today I tried to install some PHP extensions for the default php docker container. My dockerfile looks like this:

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 /

I got 2 errors by default.

Err:1 http://deb.debian.org/debian stretch InRelease Temporary failure resolving 'deb.debian.org' Could not resolve 'archive.ubuntu.com'

AND

E: Package 'php-json' has no installation candidate

Upvotes: 0

Views: 5842

Answers (1)

Nils Zenker
Nils Zenker

Reputation: 709

The Solution to this was:

E: Package 'php-json' has no installation candidate

fixed with this line in dockerfile

RUN rm /etc/apt/preferences.d/no-debian-php

AND

Err:1 http://deb.debian.org/debian stretch InRelease Temporary failure resolving 'deb.debian.org' Could not resolve 'archive.ubuntu.com'

Fixed with

Uncomment the following line in /etc/default/docker
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

Upvotes: 0

Related Questions