Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
docker php:7.1-fpm-alpine fails to build GD

Trying to build from the official php:7.1-fpm-alpine image, using the following excerpt in my Dockerfile:

FROM php:7.1-fpm-alpine

RUN set -ex \
    apk add --no-cache --virtual .build-deps \
    freetype-dev \
    libjpeg-turbo-dev \
    libpng-dev \
\
    && docker-php-ext-configure gd \
        --with-freetype-dir=/usr \
        --with-png-dir=/usr \
        --with-jpeg-dir=/usr \
    && docker-php-ext-install gd \
    && apk del .build-deps

When attempting to build this with docker build, GD fails during ./configure with the following error:

configure: error: jpeglib.h not found

I can confirm that jpeglib.h exists and is exactly where I think it should be (indeed, exactly where it is in Debian variants):

$ docker run -it --rm php:7.1-fpm-alpine /bin/sh
>$ apk add --no-cache libjpeg-turbo-dev \
   && find /usr -type f -name 'jpeglib.h'
   ...
   /usr/include/jpeglib.h

But if I take exactly the same command used in the dockerfile and run it interactively inside the container, it builds flawlessly. No errors.

Is this a bug, or am I missing something?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The problem was a blindingly simple syntax error; the apk call following the set command needs to be preceded by &&, otherwise the interpreter is treating the entire apk call as a set of arguments to set. In that case, the packages aren't added, therefore jpeglib.h didn't exist.

When I typed the command into the shell, I used the correct syntax, so it passed without error.

over 4 years ago · Santiago Trujillo Report

0

yes, you should write like this

RUN set -ex \
    && apk add --no-cache --virtual .build-deps \
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!