Error while Building Docker Image with PHP 8.2-fpm-bullseye

I want to build this Dockerfile, but I am encountering this error.
PS: It’s working on MacOS but doesn’t work with Windows (I’m using WSL 2 integration with Windows 11)

Dockerfile:

FROM php:8.2-fpm-bullseye

ENV ACCEPT_EULA=Y

# Install prerequisites required for tools and extensions installed later on.
RUN apt-get update \
    && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev unzip \
    && rm -rf /var/lib/apt/lists/*

# Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions.
# Some packages are pinned with lower priority to prevent build issues due to package conflicts.
# Link: https://github.com/microsoft/linux-package-repositories/issues/39
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
    && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
    && apt-get update \
    && ACCEPT_EULA=Y apt-get install -y msodbcsql18 \
    && ACCEPT_EULA=Y apt-get install -y mssql-tools18 \
    && apt-get install -y unixodbc-dev \
    && rm -rf /var/lib/apt/lists/*

# Retrieve the script used to install PHP extensions from the source container.
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions

# Install required PHP extensions and all their prerequisites available via apt.
RUN chmod uga+x /usr/bin/install-php-extensions \
    && sync \
    && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip pdo pdo_mysql

# Setting the work directory.
WORKDIR /var/www/app

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN curl -sS https://get.symfony.com/cli/installer | bash

Error:

failed to solve: process "/bin/sh -c chmod uga+x /usr/bin/install-php-extensions     
&& sync && install-php-extensions bcmath ds exif gd intl 
opcache pcntl pdo_sqlsrv redis sqlsrv zip pdo pdo_mysql" 
did not complete successfully: exit code: 1

I tried different installation processes for PHP extensions, but none of the solutions are working.

My versions:

Windows:
Windows 11 build version: 22621.2283

WSL:
OS: Ubuntu 22.04 jammy(on the Windows Subsystem for Linux)
Kernal: Linux 5.10.16.3-microsoft-standard-WSL2

Docker
Docker version 24.0.5, build ced0996

I would put the 3 commands in separate RUN statements to narrow the error location down.