Why docker-php-ext-install does not contains some extensions, and has it advantages over pecl?
The answer may become irrelevant to the question. Still, I am adding the following snippet in case someone comes here as I did and can install mongodb extension for php in a docker container. I am using php7.3-fpm. https://www.php.net/manual/en/mongodb.installation.pecl.php
RUN pecl install mongodb \
&& echo "extension=mongo.so" > /usr/local/etc/php/conf.d/mongo.ini
I am using this command lines and working for me. Get docker container id with docker ps
command and docker exec -it <container id> bash
apt-get update
apt-get install openssl libssl-dev libcurl4-openssl-dev
pecl install mongo
echo "extension=mongo.so" > /usr/local/etc/php/conf.d/mongo.ini
My docker kept complaining that it could not find the mongo.so extension. Finally i figured it out to run the following
RUN apt-get install -y openssl libssl-dev libcurl4-openssl-dev
RUN pecl install mongodb-1.6.0
RUN docker-php-ext-enable /usr/local/lib/php/extensions/no-debug-non-zts-20180731/mongodb.so
It seems like docker wants that you enable a php extension via docker-php-ext-enable