V
V
Viktor2019-03-11 16:11:58
Composer
Viktor, 2019-03-11 16:11:58

How to install the gd library in a container?

There is a docker container php:7.1-fpmon which lumen is spinning. There was a need to install a library maatwebsite/excelfor exporting information to Excel, but the one composer require maatwebsite/excelexecuted in the container swears at the lack of a library gd. I tried to install it and register in the php.inifollowing 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

(+ all sorts of combinations like extension=gd, docker-php-ext-install gd, etc.)
The result has not changed, the composer complains about the lack of the gd library.
In connection with this question: How can I correctly install gd in a container for php7.1 fpm?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Mirilaczvili, 2019-03-11
@2ord

Install libgd-dev, libgd2

C
chupasaurus, 2019-03-11
@chupasaurus

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 question

Ask a Question

731 491 924 answers to any question