Explore Kartoza

Try searching for: QGIS, Training, GeoNode, PostGIS

PostGIS
Back to Docker Images
Database PostGIS
21M+ pulls 198 stars

kartoza/postgis

Production-ready PostGIS database with automatic clustering, replication, and backup support.

Overview

The Kartoza PostGIS Docker image provides a production-ready PostgreSQL database with the PostGIS spatial extension pre-installed and configured. It’s the most popular geospatial database container on Docker Hub with over 21 million pulls.

Features

  • Multiple PostgreSQL versions - Support for PostgreSQL 12, 13, 14, 15, and 16
  • PostGIS extensions - Includes PostGIS, PgRouting, and other spatial extensions
  • Replication support - Built-in master/slave replication configuration
  • Automatic backups - Integration with pg-backup container
  • SSL/TLS support - Secure database connections out of the box
  • Health checks - Built-in health check endpoints

Quick Start

Basic Usage

docker run -d \
  --name postgis \
  -e POSTGRES_USER=docker \
  -e POSTGRES_PASS=docker \
  -e POSTGRES_DBNAME=gis \
  -p 5432:5432 \
  kartoza/postgis:16-3.4

With Persistent Storage

docker run -d \
  --name postgis \
  -e POSTGRES_USER=docker \
  -e POSTGRES_PASS=docker \
  -e POSTGRES_DBNAME=gis \
  -v postgis_data:/var/lib/postgresql \
  -p 5432:5432 \
  kartoza/postgis:16-3.4

Docker Compose

version: '3.8'
services:
  db:
    image: kartoza/postgis:16-3.4
    environment:
      - POSTGRES_USER=docker
      - POSTGRES_PASS=docker
      - POSTGRES_DBNAME=gis
      - ALLOW_IP_RANGE=0.0.0.0/0
    volumes:
      - postgis_data:/var/lib/postgresql
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U docker"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgis_data:

Environment Variables

VariableDescriptionDefault
POSTGRES_USERDatabase superuser namedocker
POSTGRES_PASSDatabase superuser passworddocker
POSTGRES_DBNAMEDefault database namegis
ALLOW_IP_RANGEIP range for connections0.0.0.0/0
POSTGRES_MULTIPLE_EXTENSIONSAdditional extensions to install-
REPLICATIONEnable replicationfalse

Available Tags

  • 16-3.4 - PostgreSQL 16 with PostGIS 3.4 (recommended)
  • 15-3.4 - PostgreSQL 15 with PostGIS 3.4
  • 14-3.4 - PostgreSQL 14 with PostGIS 3.4
  • 13-3.4 - PostgreSQL 13 with PostGIS 3.4

Upstream Project

This image packages PostGIS, the spatial database extender for PostgreSQL. PostGIS adds support for geographic objects allowing location queries to be run in SQL.

We gratefully acknowledge the PostGIS project and the PostgreSQL Global Development Group for their excellent work on these foundational open source projects.

Need Help with This Image?

We provide support, customization, and managed hosting for all our Docker images.