For PHP 8.4.3 on Debian 12 "bookworm", the OS of the official docker image, add the following to your Dockerfile:
Dockerfile
RUN apt-get install -y libgmp-dev && \ docker-php-ext-install -j$(nproc) gmp