1

I am on win home, using docker toolbox and getting this error:

make: /bin/sh: Operation not permitted make: *** [Makefile:243: pdo.lo] Error 127 ERROR: Service 'php' failed to build: The command '/bin/sh -c docker-php-ext-install pdo pdo_mysql' returned a non-zero code: 2

php.dockerfile

FROM php:8.0.9-fpm-alpine

WORKDIR /var/www/html

COPY src .

RUN docker-php-ext-install pdo pdo_mysql

RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
 
USER laravel

docker-compose.yml

version: "3.7"
services: 
  server:
    image: nginx:stable-alpine
    ports:
      - 80:80
    volumes:
      - ./src:/var/www/html
      - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on: 
      - php
      - mysql

  php:
    build:
      context: .
      dockerfile: dockerfiles/php.dockerfile
    volumes: 
      - ./src:/var/www/html:delegated

  mysql:
    image: mysql:8.0
    env_file: 
      - ./env/mysql.env

  composer:
    build:
      context: ./dockerfiles
      dockerfile: composer.dockerfile
    volumes: 
      - ./src:/var/www/html

Any help or suggestion is greatly appreciated

2 Answers 2

1

I was facing the same issue. After updating php-fpm to a minor version up to 8.0.9. I couldn't build the image with Docker version 19.03.1.

But with Docker version 20.10.8 build the passes OK. You could also try to update Docker and try to build again. It might help you out.

Sign up to request clarification or add additional context in comments.

1 Comment

Heya, thanks for the response. However, I am using docker toolbox and unfortunately toolbox is deprecated so it just supports till Docker version 19.03.1. Higher versions of docker require docker desktop i think but that works on win 10 pro with Hyper V enabled or on linux OS. But its good to know the cause of the problem.
0

I was having the same problem, docker-php-ext-install failing with Operation not permitted.

After some experimening, I found out it only fails the first time. Second time it always worked for me. Not sure why, might be overlay filesystems... ¯\_(ツ)_/¯ Anyway, I came back here to write my solution for people having the same issue in the future, as this is now the highest ranking search result for the error message.

I solved it with this Dockerfile, running docker-php-ext-install twice, ignoring errors first time:

FROM php:8.3-apache
RUN apt-get update && apt-get install -y libzip-dev
RUN (docker-php-ext-install zip || true) ; docker-php-ext-install zip

I was on a Raspberry Pi 4 with Docker version 20.10.5+dfsg1, build 55c4c88

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.