I am using the official php docker image as base for my application container, so the Dockerfile starts like so:
FROM php:5.6-fpm-jessie
Later in the file I would like to have something like that:
RUN apt-get update \
&& apt-get install -y libssh2-1-dev libssh2-1 \
&& docker-php-ext-install ssh2
But that tells me:
/usr/src/php/ext/ssh2 does not exist
So since that is a debian (yessie) based image, only the old php5 packages are available and php7 is installed by some tricky script in the php:fpm dockerfile and it seams that all extensions are compiled within the used php executable.
How can I install more extensions in this scenario?
In case you are using PHP >=8.0 image:
FROM php:8.0.2-fpm
RUN apt-get install -y libssh2-1-dev libssh2-1 \
&& pecl install ssh2-1.3.1 \
&& docker-php-ext-enable ssh2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With