1 min read

php:5.6-apache docker container with GD (and jpeg) compiled

I was trying to get the official php:5.6-apache docker container compiled with GD for a project. GD would install, but the JPEG support was missing. I managed to figure out the missing libraries and config in the end.

This is what my Dockerfile looks like now, with the important bits in bold:

FROM php:5.6-apache

RUN apt-get update \
    && apt-get install **libpng12-dev libfreetype6-dev libjpeg62-turbo-dev** -qy \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN **docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/** \
    && docker-php-ext-install gd