I’m trying to upgrade an Alpine image from PHP 7.4 to PHP 8.1.
This is the Dockerfile
:
FROM php:8.1-fpm-alpine
RUN apk update &&
apk add bash build-base gcc wget git autoconf libmcrypt-dev
g++ make openssl-dev
php8-openssl
php8-pdo_mysql
php8-mbstring
php8-mcrypt
The errors I get are those:
#7 3.780 php8-mbstring (no such package):
#7 3.780 ERROR: unable to select packages:
#7 3.867 required by: world[php8-mbstring]
#7 3.867 php8-mcrypt (no such package):
#7 3.867 required by: world[php8-mcrypt]
#7 3.867 php8-openssl (no such package):
#7 3.867 required by: world[php8-openssl]
#7 3.867 php8-pdo_mysql (no such package):
#7 3.867 required by: world[php8-pdo_mysql]
How can install these extensions?
I also tried to add main
and community
repos, but without success:
FROM php:8.1-fpm-alpine
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN apk update &&
apk add bash build-base gcc wget git autoconf libmcrypt-dev
...
2
Answers
As pointed out by elburro1887, there is no package
php81-mcrypt
in the list of packages available for Alpine.The reason was explained by Álvaro González in the comments to my question
So, I ended up using PECl in the meantime (I think the library should be removed and substituted with something else) and this is the resulting working
Dockerfile
:Thank you to all of you for the support!
The Alpine packages for PHP 8.1 look like "
php81-xxx
".Here you can see a list of the available packages for Alpine:
It seems there is no package called
php81-mcrypt
. There is a package calledphp81-pecl-mcrypt
, but I’m not sure if it’s the one you want.So removing
mcrypt
, this would be a working Dockerfile: