docker php7.2-fpm can't install imap module

To use imap module with PHP in Docker you must configure extension like this

docker-php-ext-configure imap --with-kerberos --with-imap-ssl

You can see an example of Dockerfile in one of my project


Actual in 2020 for PHP 7.4 and PHP 8 on Linux Alpine

RUN apk add imap-dev krb5-dev
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
        && docker-php-ext-install imap \
        && docker-php-ext-enable imap

Tags:

Docker

Php

Imap