Php8.1-pgsql package is not found

I am trying to create a docker compose image file with php8.1, but I am getting this error.

I am trying to build image for Laravel server. I have tried running the Dockerfile as root as well.

How can I fix this, turns out php8.1 uses Debian base image.

I have tried

  • using www-user from base image and then its says permissions error
  • using root user I get package not found error. But in ubuntu server that i am using I am finding the package from apt.
  • If I try to add php apt repository it bring up error of public key
FROM serversideup/php:8.1-fpm-nginx

ENV SSL_MODE "off"

USER root

RUN add-apt-repository ppa:ondrej/php
RUN apt update

RUN apt-get install -y --no-install-recommends git curl wget php8.1-pgsql libxrender1 cron fonts-freefont-ttf  
    && apt autoclean && apt autoremove 
    && rm -rf /tmp/* /var/tmp/* /usr/share/doc/*

USER www-data

COPY --chown=webuser:webgroup . /var/www/html/

RUN composer install
RUN composer du
RUN chown -R webuser:webgroup .

RUN chmod +x ./scripts/start.sh
RUN sh ./scripts/start.sh

ubuntu@ip-172-31-0-58:~/Morgenland-Search-Backend$ sudo docker compose -f docker-compose-prod.yml up -d --build
[+] Building 3.5s (6/12)                                                                                                                                                                         docker:default
 => [app internal] load build definition from Dockerfile.prod                                                                                                                                              0.0s
 => => transferring dockerfile: 523B                                                                                                                                                                       0.0s
 => [app internal] load .dockerignore                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                            0.0s
 => [app internal] load metadata for docker.io/serversideup/php:8.1-fpm-nginx                                                                                                                              0.4s
 => CACHED [app 1/8] FROM docker.io/serversideup/php:8.1-fpm-nginx@sha256:812c9d05672415f88b0d9ec7a871d50f30c6a8bfae6ea01f6da363c0bc822c38                                                                 0.0s
 => [app internal] load build context                                                                                                                                                                      0.2s
 => => transferring context: 321.85kB                                                                                                                                                                      0.2s
 => ERROR [app 2/8] RUN apt update     && apt install -y --no-install-recommends git curl wget php8.1-pgsql libxrender1 cron fonts-freefont-ttf      && apt autoclean && apt autoremove     && rm -rf /tm  3.1s
------
 > [app 2/8] RUN apt update     && apt install -y --no-install-recommends git curl wget php8.1-pgsql libxrender1 cron fonts-freefont-ttf      && apt autoclean && apt autoremove     && rm -rf /tmp/* /var/tmp/* /usr/share/doc/*:
0.300
0.300 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.300
0.329 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
0.330 Get:2 http://nginx.org/packages/debian bookworm InRelease [2860 B]
0.338 Get:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
0.338 Get:4 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
0.391 Get:5 http://nginx.org/packages/debian bookworm/nginx amd64 Packages [7975 B]
0.463 Get:6 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB]
0.539 Get:7 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.8 kB]
0.585 Get:8 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [158 kB]
1.409 Fetched 9223 kB in 1s (8465 kB/s)
1.409 Reading package lists...
2.004 Building dependency tree...
2.164 Reading state information...
2.190 5 packages can be upgraded. Run 'apt list --upgradable' to see them.
2.195
2.195 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2.195
2.198 Reading package lists...
2.780 Building dependency tree...
2.932 Reading state information...
2.958 E: Unable to locate package php8.1-pgsql
2.958 E: Couldn't find any package by glob 'php8.1-pgsql'
------
failed to solve: process "/bin/sh -c apt update     && apt install -y --no-install-recommends git curl wget php8.1-pgsql libxrender1 cron fonts-freefont-ttf      && apt autoclean && apt autoremove     && rm -rf /tmp/* /var/tmp/* /usr/share/doc/*" did not complete successfully: exit code: 100