The pglayers project introduces a novel approach to including PostgreSQL extensions in Docker deployments. Instead of building extensions into a custom image or installing them via package managers at runtime, pglayers publishes each extension as a minimal Docker image built from FROM scratch. These images contain only the essential files: shared libraries, control files, SQL scripts, and correct filesystem paths.
- Ready-to-use layers: Extensions like pgvector, PostGIS, pgRouting, TimescaleDB, pg_duckdb, h3-pg, and pg_cron are available as separate images. You compose them onto the official
postgresimage usingCOPY --from=:FROM postgres:17thenCOPY --from=ghcr.io/pglayers/pgx-pgvector:17 / /, etc. - No build steps: No
apt-get, nomake, no compilation. The final image stays lean — just the official Postgres plus the extension binaries. - Preconfigured full image:
ghcr.io/pglayers/pglayers-full:17includes all 53 extensions withshared_preload_librariesalready set. There's also an Azure profile (28 extensions) matching Azure Database for PostgreSQL Flexible Server, ideal for local dev/test. - Extensions covered: 53 extensions across categories: AI/ML (
pgvector), Geospatial (PostGIS,pgRouting,h3-pg), Time-series (TimescaleDB), Analytics (pg_duckdb), Observability, and more.
For developers, this means drastically simpler Dockerfile maintenance and faster iteration. No more custom build stages or dependency hell. To use an extension, just CREATE EXTENSION as usual after layering. This approach also enables sharing extension sets (e.g., an Azure-compatible profile) and ensures consistency between development and production environments.