Docker gd module for PHP 7 Docker gd module for PHP 7 docker docker

Docker gd module for PHP 7


This will help you

FROM php:7.0-fpmRUN 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


maybe should try this

# Install GDRUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-devRUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/RUN docker-php-ext-install gd


With PHP 7.2 I got the following error when trying the accepted/other answers:

E: Package 'libpng12-dev' has no installation candidate

This worked for me:

FROM php:7.2-fpmRUN apt update \    && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev \    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \    && docker-php-ext-install -j$(nproc) intl pdo_mysql bcmath mbstring exif gd

Note the change from libpng-dev12 to libpng-dev