I was running php7 on alpine without a hitch for the last week till today when I rebuilt my image and now nothing works. I get the errors:
/ # apk add php7
ERROR: unsatisfiable constraints:
php7 (missing):
required by: world[php7]
for every package , extension I was trying to install and that previously worked. Here's the RUN command I was using to setup php7:
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --update \
php7-mcrypt \
php7-soap \
php7-openssl \
php7-gmp \
php7-pdo_odbc \
php7-json \
php7-dom \
php7-pdo \
php7-zip \
php7-mysqli \
php7-sqlite3 \
php7-pdo_pgsql \
php7-bcmath \
php7-gd \
php7-odbc \
php7-pdo_mysql \
php7-pdo_sqlite \
php7-gettext \
php7-xmlreader \
php7-xmlrpc \
php7-bz2 \
php7-iconv \
php7-pdo_dblib \
php7-curl \
php7-ctype \
php7-fpm
All the above extensions installed flawlessly last week. What I'm I missing?
Proof the packages do exist: https://pkgs.alpinelinux.org/packages?name=php7-*&branch=&repo=&arch=&maintainer=
You should use the official PHP 7 Alpine image on DockerHub.
Then, per the image documentation, use the docker-php-ext-install
command in your Dockerfile:
FROM php:7-fpm-alpine
RUN apk update \
&& apk add libmcrypt-dev \
&& docker-php-ext-install mcrypt mysqli pdo_mysql \
&& rm /var/cache/apk/*
This may initially look a little strange, but it works and is the officially supported Docker approach.
We provide the helper scripts docker-php-ext-configure, docker-php-ext-install, and docker-php-ext-enable to more easily install PHP extensions.