Sign inSign up

svcops/postgres-ext

By svcops

•Updated 11 days ago

PostgreSQL with PostGIS, TimescaleDB, pgvector, pgRouting, pg-stat-kcache, and OSM tools.

Image
0

1.5K

svcops/postgres-ext repository overview

⁠postgres-ext

postgres-ext is a PostgreSQL image based on the official postgres:<major> image, with common spatial, routing, vector, time-series, and diagnostic extensions installed at build time.

The image installs extension packages only. You still enable the extensions per database with CREATE EXTENSION.

Docker Hub image:

svcops/postgres-ext:<major>

Supported tags:

15 16 17 18

⁠Included Packages

Each PostgreSQL major tag includes:

PackagePurpose
postgresql-<major>-postgis-3Spatial data support with PostGIS.
postgresql-<major>-pgroutingRouting and graph algorithms for PostGIS data.
postgresql-<major>-pg-stat-kcacheKernel-level CPU and I/O statistics for queries.
postgresql-<major>-pgvectorVector type and similarity search support.
postgresql-contrib-<major>PostgreSQL contrib extensions such as pg_trgm, uuid-ossp, and pg_stat_statements.
osm2pgroutingImport OpenStreetMap data into pgRouting-ready tables.
timescaledb-2-postgresql-<major>TimescaleDB time-series extension, enabled by default at build time.

The image also includes basic operational tools: ca-certificates, curl, wget, gnupg, lsb-release, and vim.

⁠Docker Usage

Start a PostgreSQL 16 container:

docker run --rm --name postgres-ext \
  -e POSTGRES_PASSWORD=postgres \
  -p 5432:5432 \
  svcops/postgres-ext:16

Some extensions, including TimescaleDB and query statistics extensions, require shared_preload_libraries before they can be created:

docker run --rm --name postgres-ext \
  -e POSTGRES_PASSWORD=postgres \
  -p 5432:5432 \
  svcops/postgres-ext:16 \
  -c shared_preload_libraries=timescaledb,pg_stat_statements,pg_stat_kcache

⁠Enable Extensions

Connect to the target database and enable only the extensions you need:

CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS pgrouting;
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS timescaledb;
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
CREATE EXTENSION IF NOT EXISTS pg_stat_kcache;

Useful contrib extensions are also available:

CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS unaccent;

⁠Verify Installation

List available extensions:

select name, default_version, installed_version
from pg_available_extensions
where name in (
               'postgis',
               'postgis_topology',
               'pgrouting',
               'vector',
               'timescaledb',
               'pg_stat_statements',
               'pg_stat_kcache'
    )
order by name;

Check PostGIS:

select postgis_full_version();

Check pgvector:

select '[1,2,3]'::vector;

Check osm2pgrouting:

osm2pgrouting --help

⁠Notes

  • This image does not initialize extensions automatically in new databases.
  • PostgreSQL major-version upgrades still require normal PostgreSQL upgrade or dump-and-restore procedures.
  • TimescaleDB and some statistics extensions may require PostgreSQL server configuration before CREATE EXTENSION succeeds.

Tag summary

Content type

Image

Digest

sha256:21acb4458…

Size

410.9 MB

Last updated

11 days ago

docker pull svcops/postgres-ext:18