Answer the question
In order to leave comments, you need to log in
How to install the gd library in a container?
There is a docker container php:7.1-fpm
on which lumen is spinning. There was a need to install a library maatwebsite/excel
for exporting information to Excel, but the one composer require maatwebsite/excel
executed in the container swears at the lack of a library gd
. I tried to install it and register in the php.ini
following way:
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# For gd
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng12-dev \
libxpm-dev \
libvpx-dev
RUN docker-php-ext-install zip
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install -j$(nproc) gd
RUN docker-php-ext-enable gd
RUN echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/gd.so' >> /usr/local/etc/php/php.ini
Answer the question
In order to leave comments, you need to log in
In Dockerfile add installation of all dependencies from this list except php*-common and libc6 which are already there.
Do not forget to add RUN rm -rf /var/lib/apt/lists/*
after installing the packages, so as not to clog the image.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question