Skip to content
HN On Hacker News ↗

GitHub - pglayers/pglayers: PostgreSQL Docker images with the extensions you actually need -- pre-built, composable, no compilation.

▲ 40 points 11 comments by iemejia 1w ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is primarily AI-generated with some human-written content

90 %

AI likelihood · overall

AI
11% human-written 89% AI-generated
SEGMENTS · HUMAN 1 of 7
SEGMENTS · AI 6 of 7
WORD COUNT 1,363
PEAK AI % 99% · §1
Analyzed
Jul 1
backend: pangram/v3.3
Segments scanned
7 windows
avg 195 words each
Distribution
11 / 89%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 1,363 words · 7 segments analyzed

Human AI-generated
§1 AI · 99%

The official PostgreSQL Docker images ship without extensions. Every time you need pgvector, PostGIS, or pg_cron, you're stuck manually installing dependencies, compiling from source, or settling for third-party images that bundle a fixed set of extensions. pglayers fixes this. It's both a ready-to-use PostgreSQL distribution with extensions pre-installed and a tool to build your own custom image with exactly the extensions you need -- all on top of the official postgres Docker images. You don't need to figure out how to build PostgreSQL extensions, install dependencies, or set up compilers. Each extension is published as a minimal Docker image layer containing only its binaries. You stack them on top of the official postgres image using COPY --from -- one line per extension, no compilation. Quick start Option 1: Ready-to-use images Pre-built combined images with shared_preload_libraries already configured: # All 53 extensions docker run -d -e POSTGRES_PASSWORD=secret ghcr.io/pglayers/pglayers-full:17

# Azure Database for PostgreSQL compatible (28 extensions) docker run -d -e POSTGRES_PASSWORD=secret ghcr.io/pglayers/pglayers-azure:17 Available profiles: full, azure. Each is published for PG 17, 18, and 19. See Profiles for details and how to create custom ones.

Note: Vendor profiles (e.g., azure) are a best-effort approximation for local development. They are not a replacement for the actual managed service -- extension versions, configuration defaults, and platform-specific behavior may differ. Use them to develop and test locally, not to replicate production exactly.

Option 2: Pick your own extensions Each extension is published as its own image layer.

§2 AI · 98%

You stack them onto the official postgres image with COPY --from -- each line adds one extension to the final image: FROM postgres:17

COPY --from=ghcr.io/pglayers/pgx-pgvector:17 / / COPY --from=ghcr.io/pglayers/pgx-pg_cron:17 / / COPY --from=ghcr.io/pglayers/pgx-postgis:17 / / Build and run: docker build -t my-postgres . docker run -d -e POSTGRES_PASSWORD=secret my-postgres No compilation happens -- Docker pulls the pre-built extension layers from the registry and overlays them onto the official image. The result is a single image with exactly the extensions you chose, composed layer by layer.

New to Docker? See Verifying your container for how to check it's running and handle port conflicts.

Supported PostgreSQL versions

Version Status

PostgreSQL 17 Stable

PostgreSQL 18 Stable

PostgreSQL 19 Experimental (beta -- supported until officially released)

All extensions are built and tested against PG 17 and 18. Support for PG 19 is best-effort while it remains in beta; some extensions may not yet have upstream compatibility. Once PG 19 reaches GA, it will be promoted to stable. Available extensions

Extension Version PG versions Description

age 1.7.0-rc0 17, 18 Graph database with openCypher query language (Apache AGE)

anon 3.1.1 17, 18 Data anonymization and masking

credcheck 5.0 17, 18, 19 Credential checks on user creation / password change

documentdb 0.113-0 17, 18 MongoDB-compatible document database engine (BSON types and CRUD API)

h3-pg 4.2.3 17, 18 Uber H3 hexagonal geospatial indexing

hll 2.21 17, 18, 19 HyperLogLog probabilistic distinct counting

§3 AI · 98%

http 1.7.1 17, 18, 19 HTTP client for PostgreSQL (web requests from SQL)

hypopg 1.4.3 17, 18, 19 Hypothetical indexes for what-if analysis

ip4r 2.4.3 17, 18, 19 IPv4/IPv6 range data types with GiST indexing

orafce 4.16.7 17, 18, 19 Oracle compatibility functions and packages

pgaudit 17.1 17, 18 Audit logging (session and object-level)

pg_bigm 1.2 17, 18 2-gram full text search (better for CJK languages)

pg_cron 1.6.7 17, 18 Job scheduler (periodic jobs inside the database)

pg_duckdb 1.1.1 17, 18 DuckDB columnar analytics engine embedded in Postgres

pg_durable 0.2.3 17, 18 In-database durable execution (fault-tolerant workflows)

pg_failover_slots 1.2.1 17, 18 Logical replication slot manager for failover

pg_graphql 1.6.1 17, 18 GraphQL support for PostgreSQL

pg_hashids 1.2.1 17, 18, 19 Short unique hash IDs from integers

pg_hint_plan 1.7.1 17, 18 Tweak execution plans using hints in SQL comments

pg_ivm 1.13 17, 18 Incremental View Maintenance for materialized views

§4 AI · 99%

pg_jsonschema 0.3.4 17, 18 JSON Schema validation

pg_net 0.20.3 17, 18, 19 Async non-blocking HTTP/HTTPS requests

pg_partman 5.4.3 17, 18, 19 Automated table partition management

pg_qualstats 2.1.4 17, 18, 19 Statistics collector for WHERE clause predicates

pg_repack 1.5.3 17, 18, 19 Online table reorganization without heavy locks

pg_roaringbitmap 1.1.0 17, 18 Roaring bitmap data type for fast set operations

pg_similarity 1.0 17, 18 Similarity functions (Levenshtein, Jaro-Winkler, Cosine, Jaccard)

pg_squeeze 1.9.3 17, 18, 19 Remove unused space from tables without heavy locks

pg_stat_monitor 2.3.2 17, 18 Enhanced query statistics with histograms and buckets

pg_textsearch 1.3.1 17, 18 BM25 relevance-ranked full-text search

pg_uuidv7 1.7.0 17, 18, 19 UUIDv7 generation (time-sortable unique identifiers)

pg_wait_sampling 1.1.9 17, 18, 19 Sampling-based statistics of wait events

pgfincore 1.4.0 17, 18, 19 Inspect and manage OS page cache for data files

pgjwt master 17, 18, 19 JSON Web Token (JWT) generation and validation

pglogical 2.4.7 17, 18, 19 Logical streaming replication using publish/subscribe model

pgrouting 4.0.1 17, 18, 19 Geospatial routing and network analysis on PostGIS

pgsodium 3.1.11 17,

§5 AI · 99%

18, 19 Modern cryptography using libsodium

pgtap 1.3.4 17, 18, 19 Unit testing framework for PostgreSQL

pgtt 4.5 17, 18, 19 Oracle-style Global Temporary Tables

pgvector 0.8.3 17, 18, 19 Vector similarity search for AI/embeddings

plpgsql_check 2.9.1 17, 18, 19 PL/pgSQL linter and validator

plprofiler 4.2.5 17, 18 Performance profiler for PL/pgSQL functions

plv8 3.2.4 17, 18 JavaScript (V8) procedural language

PostGIS 3.6.4 17, 18, 19 Geospatial extensions (geometry, geography, raster, MVT)

postgres_protobuf 0.3.2 17, 18, 19 Protocol Buffer support (query, convert to/from JSON)

prefix 1.2.11 17, 18, 19 Prefix range data type for phone routing lookups

rum 1.3.15 17, 18 GIN-like index with ordering for full text search

semver 0.41.0 17, 18, 19 Semantic version data type

tdigest 1.4.3 17, 18, 19 T-digest for quantile and percentile estimation

tds_fdw 2.0.5 17, 18 Foreign data wrapper for SQL Server and Sybase

temporal_tables 1.2.2 17, 18 System-period temporal

§6 AI · 94%

tables

timescaledb 2.28.1 17, 18 Time-series hypertables, compression, continuous aggregates

wal2json 2.6 17, 18 JSON output plugin for logical replication / CDC

wrappers 0.6.2 17, 18 Foreign Data Wrapper framework (Stripe, S3, Firebase, etc.)

Image tags Each extension is published with two tag formats:

pgx-<extension>:<pg_major> -- latest build (e.g. pgx-pgvector:17) pgx-<extension>:<pg_major>-<version> -- pinned version (e.g. pgx-pgvector:17-v0.8.3)

All images are multi-architecture (linux/amd64 and linux/arm64) and hosted on GHCR at ghcr.io/pglayers/pgx-*. Docker automatically pulls the correct architecture for your platform. Configuration notes shared_preload_libraries Some extensions require entries in shared_preload_libraries. Add this to your Dockerfile after the COPY lines: RUN echo "shared_preload_libraries = 'pg_cron,pgaudit,pg_partman_bgw'" \ >> /usr/share/postgresql/postgresql.conf.sample Extensions that need this:

Extension Library name

age age

anon anon

credcheck credcheck

pg_cron pg_cron

pg_duckdb pg_duckdb

pg_durable pg_durable

pg_failover_slots pg_failover_slots

pg_hint_plan pg_hint_plan

pg_net pg_net

pg_partman pg_partman_bgw

pg_qualstats pg_qualstats

pg_squeeze pg_squeeze

pg_stat_monitor pg_stat_monitor

pg_textsearch pg_textsearch

pg_wait_sampling pg_wait_sampling

pgaudit pgaudit

pglogical pglogical

pgsodium pgsodium

pgtt pgtt

plprofiler plprofiler

timescaledb timescaledb

CREATE EXTENSION Extensions must be created in each database where you want to use them.

§7 Human · 13%

You can automate this with an init script: COPY <<'EOF' /docker-entrypoint-initdb.d/10-extensions.sql CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTENSION IF NOT EXISTS pg_cron; CREATE EXTENSION IF NOT EXISTS postgis; EOF This runs automatically on first container start (when the data directory is initialized). PostGIS The PostGIS extension image bundles its runtime shared libraries (libgeos, libproj, libgdal, libjson-c, libprotobuf-c, and PROJ/GDAL data files), so COPY --from is fully self-contained. Geometry, geography, topology, raster, and MVT (Mapbox Vector Tiles) are all included. To enable GDAL raster format drivers (GeoTIFF, PNG, etc.), set the environment variable: ENV POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL By default, GDAL drivers are disabled for security (same as the official PostGIS Docker image). DocumentDB DocumentDB provides a MongoDB-compatible document database engine built on PostgreSQL. It consists of two extensions:

documentdb_core -- BSON data type and core operations (no dependencies, works standalone). documentdb -- Full CRUD API surface. Requires documentdb_core, pg_cron, vector (pgvector), postgis, and tsm_system_rows.

Create extensions in order: CREATE EXTENSION IF NOT EXISTS documentdb_core; -- For the full API (requires pg_cron, vector, postgis layers): CREATE EXTENSION IF NOT EXISTS documentdb; How it works The project publishes one Docker image per extension per PostgreSQL version. These are not runnable containers -- they are FROM scratch images containing only the extension artifacts laid out at the correct filesystem paths: /usr/lib/postgresql/17/lib/vector.so /usr/share/postgresql/17/extension/vector.control /usr/share/postgresql/17/extension/vector--0.8.3.sql

When you write COPY --from=ghcr.io/pglayers/pgx-pgvector:17 / / in your Dockerfile, Docker copies these files into the official postgres image at exactly the right locations. PostgreSQL finds them and you can CREATE EXTENSION.