1

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=

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
Jonathan
  • 10,792
  • 5
  • 65
  • 85

2 Answers2

6

Package php7 has been moved from the testing to the community repository, so you have to replace http://dl-cdn.alpinelinux.org/alpine/edge/testing with http://dl-cdn.alpinelinux.org/alpine/edge/community.

Jakub Jirutka
  • 10,269
  • 4
  • 42
  • 35
  • Thank you!! I had a feeling they'd been moved somewhere but I couldn't find them in any of the repos I checked out. Is there any way to be notified if there're any changes like this? This took me back a bit in development time. – Jonathan Aug 31 '16 at 09:05
  • Thanks. Is there any documentation about alpine repos? – kristianp Jul 25 '18 at 23:28
3

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.

DockerHub - PHP

DevOps Dan
  • 1,724
  • 11
  • 11
  • 2
    Starting in Alpine:3.3 you can now skip the udpate and cleanup. You do `apk --no-cache add ...`. It's more efficient. https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md#disabling-cache – Bernard Aug 30 '16 at 04:52
  • Thanks @Alkaline DevOpsDan . It does seem strange, but what really gets me is that this was working pretty much on Friday and totally broke yesterday. – Jonathan Aug 30 '16 at 07:36