docker - GD install within php:8.0-fpm-alpine throwing [gd.lo] Error 127
问题描述
I was using this docker file barely 2 months ago for deploys and never had a problem. Today I'm getting errors trying to compile it. What could have broken? How do I solve this?
make: *** [Makefile:212: gd.lo] Error 127
The command '/bin/sh -c NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && docker-php-ext-install -j${NPROC} gd' returned a non-zero code: 2
Docker file
FROM php:8.0-fpm-alpine
ADD ./docker/www.conf /usr/local/etc/php-fpm.d/www.conf
RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
WORKDIR /app
RUN chown laravel:laravel /app
RUN apk add --no-cache \
freetype \
libpng \
libjpeg-turbo \
freetype-dev \
libpng-dev \
libjpeg-turbo-dev \
gmp \
gmp-dev
RUN docker-php-ext-configure gd \
--with-freetype \
--with-jpeg
# THIS FAILS
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j${NPROC} gd
RUN apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
RUN docker-php-ext-install pdo pdo_mysql gmp fileinfo exif
RUN apk add --no-cache $PHPIZE_DEPS
RUN apk add icu-dev
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN docker-php-ext-configure intl && docker-php-ext-install intl
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
COPY ./src/. .
EXPOSE 9000
Travis Error
---> c7a23065c141
Step 8/35 : RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && docker-php-ext-install -j${NPROC} gd
---> Running in f640c4594a0d
/bin/sh /usr/src/php/ext/gd/libtool --mode=compile cc -I. -I/usr/src/php/ext/gd -I/usr/src/php/ext/gd/include -I/usr/src/php/ext/gd/main -I/usr/src/php/ext/gd -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/libpng16 -I/usr/include/freetype2 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/src/php/ext/gd/libgd -c /usr/src/php/ext/gd/gd.c -o gd.lo
make: /bin/sh: Operation not permitted
make: *** [Makefile:212: gd.lo] Error 127
The command '/bin/sh -c NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && docker-php-ext-install -j${NPROC} gd' returned a non-zero code: 2
No stash entries found.
Script failed with status 2
failed to deploy
解决方案
推荐阅读
- python - 使用拆分和替换来安排数据框,反斜杠有问题
- list - 如何排除此正则表达式的其他匹配项?
- javascript - TypeError: (0 , _dataActions.loginUser) 不是函数
- javascript - 从 Div 获取匹配的文本
- perl - 如何为 perl 中的 Getopt::Std 中的一个选项提供更多参数(以空格分隔)?
- python - 部分付款后如何将发票标记为已付款
- javascript - 在不调用 click 命令的情况下使用 Cypress 单击按钮?
- c++ - 用其他变量打印 c++ 变量会改变值
- reactjs - React Redux,来自 reducer 的值在 console.log 上显示为 undefined
- python - 使用正则表达式提取找到第二个匹配项