Need Docker compose with Postgres db

Anybody could share please a working yaml with official Nextcloud container and Postgres? Mine doesn’t work, probably is a volume problem.

services:
  nc:
    image: nextcloud
    links:
      - db
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - POSTGRES_HOST=db
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
    ports:
      - 8080:80
    restart: always
    volumes:
      - ./nextcloud:/var/www/html
      - ./config:/var/www/html/config
      - ./data:/var/www/html/data

  db:
    image: postgres:alpine
    environment:
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
    restart: always
    volumes:
      - /var/lib/docker/volumes/postgresql:/var/lib/postgresql/data
    expose:
      - 5432

What did your container logs says? I try with your docker-compose config it works but i edit

/var/lib/docker/volumes/postgresql:/var/lib/postgresql/data

to

./postgresql:/var/lib/postgresql/data

look at his example Nextcloud docker-compose setup with notify_push (2024)