php:7.4-fpm-alpine /bin/sh: Operation not permitted

Created on 20 Feb 2021  路  3Comments  路  Source: docker-library/php

Hello! Faced an issue while rebuilding my image:

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /tmp/pear/temp/pear-build-defaultusermjFaAE/apcu-5.1.19/libtool --mode=compile cc -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/apcu -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultusermjFaAE/apcu-5.1.19/include -I/tmp/pear/temp/pear-build-defaultusermjFaAE/apcu-5.1.19/main -I/tmp/pear/temp/apcu -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  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/apcu/apc.c -o apc.lo
make: /bin/sh: Operation not permitted
make: *** [Makefile:194: apc.lo] Error 127
ERROR: `make' failed
ERROR: Service 'php' failed to build : The command '/bin/sh -c set -ex     && apk add --no-cache --virtual .build-deps         autoconf         bzip2-dev         curl-dev         file         freetype-dev         gcc         git         krb5-dev         krb5-conf         libc-dev         libpng-dev         make         oniguruma-dev         postgresql-dev         zlib-dev     && pecl install apcu igbinary xdebug     && docker-php-ext-enable apcu igbinary xdebug     && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini     && echo "xdebug.remote_connect_back=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini     && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini     && echo "xdebug.remote_mode=req" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini     && yes | pecl install redis     && docker-php-ext-enable redis     && docker-php-ext-configure gd        --with-freetype=/usr/include/        --with-jpeg=/usr/include/     && docker-php-ext-configure pgsql -with-pgsql=/usr/include/postgresql/     && docker-php-ext-install         bcmath         curl         gd         intl         json         mbstring         opcache         pcntl         pgsql         pdo         pdo_pgsql         soap         sockets         xsl         zip     && apk del --no-network .build-deps' returned a non-zero code: 1

This config worked for me previously (~nov-dec 2020) but broken down now:


Dockerfile

FROM php:7.4-fpm-alpine

# Locale
ENV LANG "C.UTF-8"
ENV LANGUAGE "C.UTF-8"
ENV LC_ALL "C.UTF-8"

# Dependencies
RUN set -ex \
    && apk update \
    && apk add --no-cache \
        bash \
        bash-completion \
        coreutils \
        freetype \
        icu-libs \
        libbz2 \
        libcurl \
        libjpeg-turbo-dev \
        libmcrypt-dev \
        libpng \
        libpq \
        libxml2 \
        libxpm-dev \
        libxslt-dev \
        libzip-dev \
        oniguruma \
        nano \
        unzip \
        util-linux \
        util-linux-bash-completion \
        wget \
        zlib \
        zstd-dev

# User utils
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN set -ex \
    && apk update \
    && apk add --no-cache \
        runuser \
        shadow

# Install PHP extensions
RUN set -ex \
    && apk add --no-cache --virtual .build-deps \
        autoconf \
        bzip2-dev \
        curl-dev \
        file \
        freetype-dev \
        gcc \
        git \
        krb5-dev \
        krb5-conf \
        libc-dev \
        libpng-dev \
        make \
        oniguruma-dev \
        postgresql-dev \
        zlib-dev \
    && pecl install apcu igbinary xdebug \
    && docker-php-ext-enable apcu igbinary xdebug \
    && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.remote_connect_back=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.remote_mode=req" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && yes | pecl install redis \
    && docker-php-ext-enable redis \
    && docker-php-ext-configure gd \
       --with-freetype=/usr/include/ \
       --with-jpeg=/usr/include/ \
    && docker-php-ext-configure pgsql -with-pgsql=/usr/include/postgresql/ \
    && docker-php-ext-install \
        bcmath \
        curl \
        gd \
        intl \
        json \
        mbstring \
        opcache \
        pcntl \
        pgsql \
        pdo \
        pdo_pgsql \
        soap \
        sockets \
        xsl \
        zip \
    && apk del --no-network .build-deps

# Composer
RUN curl -sS https://getcomposer.org/installer | \
    php -- --filename=composer --install-dir=/usr/local/bin && \
    php /usr/local/bin/composer clear-cache

COPY docker-php-entrypoint /usr/local/bin/

RUN chmod +x /usr/local/bin/docker-php-entrypoint

RUN useradd -m -U -s /bin/bash hostuser

RUN mkdir /home/hostuser/app && \
    chown hostuser:hostuser /home/hostuser/app

WORKDIR /home/hostuser/app

VOLUME /home/hostuser/app

Most helpful comment

Solved with using FROM php:7.4-fpm-alpine3.13 & removing this:

RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories

All 3 comments

Solved with using FROM php:7.4-fpm-alpine3.13 & removing this:

RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories

Indeed, mixing Alpine's edge and stable releases has always had unexpected behavior in our experience.

If you wanted to dig deeper, it sounds like this might be related to https://github.com/alpinelinux/docker-alpine/issues/146 in some way.

I got the similar error with Docker version 19.03.15. After updating Docker to 20.10.7 this error is gone.

Was this page helpful?
0 / 5 - 0 ratings