AI & LLMs1 GB RAM (Pro recommended)· Port 5432

Deploy PostgreSQL 16 + pgvector with Docker Compose

PostgreSQL 16 preloaded with the pgvector extension for HNSW & IVFFlat AI embedding similarity search.

1. Production docker-compose.yml Configuration

Copy this stack definition or deploy directly from your Vexlo Cloud console with automatic Let's Encrypt TLS and persistent volume mounts.

docker-compose.yml
yaml
services:
  postgres-pgvector:
    image: pgvector/pgvector:pg16
    restart: unless-stopped
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-change-me-strong-pg-password}
      - POSTGRES_DB=${POSTGRES_DB:-vectordb}
    volumes:
      - app_data:/var/lib/postgresql/data


volumes:
  app_data:

2. Required Environment Variables

VariableDefault / ExampleDescription
POSTGRES_USERpostgresSuperuser username for PostgreSQL 16.
POSTGRES_PASSWORDchange-me-strong-pg-passwordSuperuser password.
POSTGRES_DBvectordbDefault database created on first boot (run CREATE EXTENSION vector;).

PostgreSQL 16 + pgvector Self-Hosting FAQs

How much RAM is required to self-host PostgreSQL 16 + pgvector in production?

PostgreSQL 16 + pgvector requires a minimum of 1 GB RAM (Pro recommended). On Vexlo Cloud Pro (₹149/mo via UPI in India or $5/mo globally), you get 2 vCPU, 3 GB RAM, and 2 managed databases—more than enough headroom for production workloads.

How do I expose PostgreSQL 16 + pgvector with automatic HTTPS/SSL on Vexlo Cloud?

Deploy the pgvector/pgvector:pg16 container on Vexlo Cloud, set the exposed port to 5432, and attach your custom domain in the Domains tab. Vexlo automatically provisions and renews Let's Encrypt TLS certificates.

How is persistent data backed up for PostgreSQL 16 + pgvector?

Mount /var/lib/postgresql/data to a persistent Docker volume and connect Vexlo Cloud's automated S3 / Cloudflare R2 backup scheduler to snapshot your database daily or weekly.

More 1-Click Docker Templates

View all 25 templates →