

Now I'm stuck due to the initially mentioned libzip issue. When finally able to run the composer install command within the container, it told me that the zip extension is needed which is why I've added the docker-php-ext-install zip command. Hence the reason for this workaround (changing the user is also what the official docs recommend according to the link above). I first tried to simply run the last line composer install -no-dev, which actually won't work, as the container won't let you execute root commands used by default by composer. RUN groupadd -r user & useradd -r -g user user If I understood it correctly, doing it in this way allows you to share your image without your colleagues needing to install composer / download the packages locally everything will then be done within the container. How can I Install libzip to finally get things running?Ī few notes on my Dockerfile lines feel free to correct me if I'm wrong in the setup it's the first time I'm doing this: COPY -from=composer:latest /usr/bin/composer /usr/bin/composerĪs I understood it, the official docs tell you to use this multi-stage approach to get composer running in your PHP Docker container in an optimal way.
#PHP 8.1 DOCKER APK#
So removing mcrypt, this would be a working 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 \ php81-openssl \ php81-pdomysql \ php81-mbstring. I can however not find that package, no matter if via pecl, via apt-get as most of the forum posts refer to. There is a package called php81-pecl-mcrypt, but I'm not sure if it's the one you want.

The composer installation fails at the point where it's telling me that the libzip package is needed. Content of my Dockerfile: FROM php:8.1-apacheĬOPY -from=composer:latest /usr/bin/composer /usr/bin/composer
