In order to install the GD extension in a Docker image, you should add the following instruction to you Dockerfile.
RUN set -eux; \ docker-php-ext-configure gd --with-freetype --with-jpeg; \ docker-php-ext-install exif gd