I have this docker-compose I’m experimenting with.
phpfpm:
restart: unless-stopped
build:
context: ./docker/php-fpm
args:
USER_ID: ${USER_ID}
environment:
XDEBUG_MODE: debug
XDEBUG_CONFIG: client_host=host.docker.internal client_port=9003
volumes:
- ./:/var/www
networks:
- app-network
The PHP Dockerfile:
ARG USER_ID
ENV USER_ID $USER_ID
RUN apt-get update && apt upgrade -y
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
RUN docker-php-ext-install mbstring bcmath cli common curl dev gd intl json mbstring mysql opcache readline xml zip
ENV TZ=Africa/Casablanca
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN adduser --uid ${USER_ID} --ingroup www-data developer --shell /bin/bash
USER developer
WORKDIR /var/www
The problem is that the Dockerfile get stuck in RUN docker-php-ext-install
giving this error :
failed to solve: executor failed running [/bin/sh -c docker-php-ext-install mbstring xdebug bcmath cli common curl dev gd intl json mbstring mysql opcache readline xml zip]: exit code: 1
And when executing docker-php-ext-install
inside this phpfpm
container i got this error :
mkdir: cannot create directory '/usr/src/php': Permission denied
How to solve that?
so how can I make it run?
Thank you