Reading time: < 1 minutes
If we are using image processing functions in PHP, we need to install and enable PHP GD in the Docker container.

To do this, we go to our Dockerfile and add the following:
# syntax=docker/dockerfile:1 FROM php:7.2.5-apache RUN docker-php-ext-install mysqli RUN docker-php-ext-install pdo_mysql RUN apt-get 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) gd RUN apt-get install -y libjpeg-dev && \ docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ && \ docker-php-ext-install -j$(nproc) gd #Activate Apache modules: RUN a2enmod headers RUN a2enmod rewrite RUN a2enmod ssl RUN /etc/init.d/apache2 restart
