If you use the official PHP image for Docker, you can install the extensions by running the command docker-php-ext-install
. If the extension has any prerequisite, it needs to be installed from your Dockerfile
before executing docker-php-ext-install
.
See an example taken from the image documentation:
FROM php:7.0-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
On the extent of curl
, it already comes enabled by default in the official image
root@58d96f139768:/# php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
As the image you are using is not based on the official image, I suggest you search for another that suits you and is based on the official image, because it is easier for you to do this type of customizations.
You can be inspired in this tutorial here to create your application containers.
How is your Dockerfile?
– Marcelo de Andrade
I’m using a picture of the Hub, and/and Orange
– Pedro Soares