I am trying to run a docker-compose file for Magento 2. But getting stuck in a weird issue regarding the installation of the extension when I am building it via Dockerfile. Hear is my Dockerfile.
FROM php:7.4-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
libxml2-dev \
libzip-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libicu-dev \
libxslt-dev \
libcurl4-openssl-dev \
libssl-dev \
libonig-dev \
libbz2-dev \
libmcrypt-dev \
libpng-dev \
libgd-dev \
libpq-dev \
libxslt1-dev
# Install PHP extensions
RUN docker-php-ext-install \
bcmath \
ctype \
curl \
dom \
fileinfo \
filter \
gd \
hash \
iconv \
intl \
json \
mbstring \
openssl \
pcre \
pdo_mysql \
simplexml \
soap \
sockets \
sodium \
tokenizer \
xmlwriter \
xsl \
zip \
zlib
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# # Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# # Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html
And I am getting an error:
failed to solve: process "/bin/sh -c docker-php-ext-install bcmath ctype curl dom fileinfo filter gd hash iconv intl json mbstring openssl pcre pdo_mysql simplexml soap sockets sodium tokenizer xmlwriter xsl zip zlib" did not complete successfully: exit code: 2
I have tried building it even with PHP-8.3
using php:8.3-fpm-bookworm
. But got the same error and have tried installing many other packages so to avoid dependency issues.
I do not want to install extensions in the container one at a time and it will defeat the purpose of using a docker container.
Please suggest what can I do to resolve my issue.