All templates

PostgreSQL 18

v1.0.0

Open source relational database.

database by rjcndev
x-arcane:
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/postgresql.svg
  urls:
    - https://www.postgresql.org/

services:
  postgres:
    image: postgres:18
    container_name: postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: "${POSTGRES_DB}"
      POSTGRES_USER: "${POSTGRES_USER}"
      POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    ports:
      - "5432:5432"
    volumes:
      - pg_data:/var/lib/postgresql/data
      - ./postgresql.conf:/etc/postgresql/postgresql.conf:ro # optional custom config
    command: ["-c", "config_file=/etc/postgresql/postgresql.conf"]
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 10s
      timeout: 5s
      retries: 5
    labels:
      com.getarcaneapp.arcane.icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/postgresql.svg

# Optional: network definition if you want to isolate the DB from other services
networks:
  default:
    driver: bridge

volumes:
  pg_data: