Source linked

Pglayers Ships 53 Prebuilt PostgreSQL Extensions as Stackable Docker Layers

Skip compiling pgvector and PostGIS from source: pglayers publishes each extension as a standalone Docker layer you stack onto the official postgres image in one line.

pglayerspostgresqldockerpgvectorpostgisdeveloper tools

Official PostgreSQL Docker images ship without extensions. Every time you need pgvector, PostGIS, or pg_cron, you're stuck installing dependencies, compiling from source, or settling for a third-party image with a fixed extension set. Pglayers ends that grind by publishing 53 extensions as standalone Docker layers you simply copy onto the official postgres image.

53 Extensions, Zero Compilation

Each extension — from pg_duckdb to pg_graphql to pg_cron — is published at ghcr.io/pglayers/pgx-<name>:<version> as a minimal image layer containing only its binaries. You stack them with a single COPY --from line in your Dockerfile. No build tools, no apt-get, no wrestling with pgxn.

I counted 53 in the README, including heavy hitters like pgvector (vector similarity search), PostGIS (geospatial), pg_duckdb (DuckDB columnar engine embedded in Postgres), and pg_partman (automated table partitioning). Exact versions are listed for PG 17, 18, and 19 — the project tracks upstream releases closely, with PG 19 in experimental beta.

Two Options: Grab the Full Image or Stack Your Own Layers

Pglayers offers pre-built combined images for the impatient. ghcr.io/pglayers/pglayers-full:17 bundles all 53 extensions. ghcr.io/pglayers/pglayers-azure:17 ships 28 extensions matching Azure Database for PostgreSQL's supported set — useful for local dev against a cloud-like environment, though the docs are clear it's not a production replica.

For anyone who wants only their actual stack, the composable approach is cleaner:

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, run, done. Docker pulls the pre-built layers from the registry and overlays them. The final image contains exactly what you asked for, no more.

From Dev to CI: Composable PostgreSQL Without the Build Hassle

This shifts the friction from "how do I compile this extension?" to "which combination of layers do I need?" For CI pipelines that rebuild images frequently, pulling pre-built layers instead of compiling from source saves minutes per run. For local dev, it means spinning up a Postgres container with pgvector and pg_cron in seconds.

The repo also includes a Makefile and extensible build system so you can add your own extensions if the 53 don't cover you. But for the vast majority of Postgres users, this catalog already covers every extension I've needed in the last three years. Next time someone asks "how do I get PostGIS into my Docker Postgres?", send them the one-liner.


Source: Show HN: Pglayers - PostgreSQL extensions as stackable Docker layers
Domain: github.com

Read original source ->

External source stays available while the OJO article and comment thread stay local.

Comments load interactively on the live page.