Show HN: Pglayers – PostgreSQL extensions as stackable Docker layers
🚀 Pglayers: Composable PostgreSQL Extensions via Docker Layers
Pglayers transforms how you handle PostgreSQL extensions. Instead of wrestling with complex build environments, it provides a system where extensions are treated as stackable Docker layers.
Check it out on GitHub: pglayers/pglayers
🛠️ The Problem & The Solution
The official PostgreSQL Docker images are lean, meaning they ship without any extensions. Traditionally, if you needed pgvector, PostGIS, or pg_cron, you were forced to:
Manually install system dependenciesCompile source code from scratchRely on bloated third-party images with rigid, pre-defined extension sets
Pglayers solves this by offering a ready-to-use distribution and a toolkit to assemble your own custom image. It sits directly on top of the official postgres images, removing the need for you to manage compilers or build logic.
How it Works: The Layering Concept
Each extension is packaged as a lightweight Docker image containing only the necessary binaries. You simply "stack" these layers using the COPY --from instruction.
Mathematically, the final image can be represented as the sum of the base image and the selected extension layers:
🚀 Quick Start Guide
Depending on your needs, you can choose between pre-configured bundles or a bespoke setup.
Option 1: Ready-to-Use Images
These images come with shared_preload_libraries already configured for convenience.
- Full Suite: Includes all 53 available extensions.
- Azure Profile: Compatible with Azure Database for PostgreSQL (28 extensions).
Deployment Commands:
# Launch the full version (PG 17)
docker run -d -e POSTGRES_PASSWORD=secret ghcr.io/pglayers/pglayers-full:17
# Launch the Azure-compatible version (PG 17)
docker run -d -e POSTGRES_PASSWORD=secret ghcr.io/pglayers/pglayers-azure:17
[!IMPORTANT] Note on Vendor Profiles: Profiles like
azureare best-effort approximations intended for local development. They are not exact replicas of managed services; differences in configuration defaults, versions, and platform behavior may exist. Use them for testing, not for mirroring production perfectly.
Option 2: Custom Composition
If you want a lean image, pick only the extensions you actually need.
Example Dockerfile:
FROM postgres:17
# Stack only the required extensions
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 Execute:
docker build -t my-postgres .docker run -d -e POSTGRES_PASSWORD=secret my-postgres
Since the layers are pre-built, no compilation occurs during the build process.
📊 Compatibility & Support
(Example representation of the containerization approach)
PostgreSQL Version Status
| Version | Status | Notes |
|---|---|---|
| PostgreSQL 17 | Stable | Fully tested and supported |
| PostgreSQL 18 | Stable | Fully tested and supported |
| PostgreSQL 19 | Experimental | Beta support; some extensions may lack upstream compatibility |
📚 Available Extension Catalog
Below is the comprehensive list of extensions provided by Pglayers.
| Extension | Version | PG Versions | Description |
|---|---|---|---|
age | 1.7.0-rc0 | 17, 18 | Apache AGE: Graph DB with openCypher |
anon | 3.1.1 | 17, 18 | Data masking and anonymization |
credcheck | 5.0 | 17, 18, 19 | User creation/password change credential checks |
documentdb | 0.113-0 | 17, 18 | MongoDB-compatible engine (BSON/CRUD) |
h3-pg | 4.2.3 | 17, 18 | Uber H3 hexagonal geospatial indexing |
hll | 2.21 | 17, 18, 19 | HyperLogLog for probabilistic counting |
http | 1.7.1 | 17, 18, 19 | SQL-based HTTP client |
hypopg | 1.4.3 | 17, 18, 19 | Hypothetical indexes for "what-if" analysis |
ip4r | 2.4.3 | 17, 18, 19 | IPv4/IPv6 range types with GiST |
orafce | 4.16.7 | 17, 18, 19 | Oracle compatibility layer |
pgaudit | 17.1 | 17, 18 | Session and object-level audit logging |
pg_bigm | 1.2 | 17, 18 | 2-gram search (optimized for CJK) |
pg_cron | 1.6.7 | 17, 18 | Internal database job scheduler |
pg_duckdb | 1.1.1 | 17, 18 | Embedded DuckDB columnar analytics |
pg_durable | 0.2.3 | 17, 18 | Fault-tolerant in-database workflows |
pg_failover_slots | 1.2.1 | 17, 18 | Logical replication slot manager for failover |
pg_graphql | 1.6.1 | 17, 18 | GraphQL interface for Postgres |
pg_hashids | 1.2.1 | 17, 18, 19 | Integer to short unique hash IDs |
pg_hint_plan | 1.7.1 | 17, 18 | SQL comment-based execution plan hints |
pg_ivm | 1.13 | 17, 18 | Incremental View Maintenance |
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 partitioning |
pg_qualstats | 2.1.4 | 17, 18, 19 | WHERE clause predicate statistics |
pg_repack | 1.5.3 | 17, 18, 19 | Online table reorganization (low lock) |
pg_roaringbitmap | 1.1.0 | 17, 18 | Fast set operations via Roaring bitmaps |
pg_similarity | 1.0 | 17, 18 | Levenshtein, Jaro-Winkler, Cosine, Jaccard |
pg_squeeze | 1.9.3 | 17, 18, 19 | Table space reclamation (low lock) |