@@ -15,7 +15,7 @@ Alpine Linux for minimal size while maintaining full spatial database functional
1515- 🔄 ** Multi-Architecture** : Native support for both ARM64 and AMD64 platforms
1616- 🧪 ** Thoroughly Tested** : Comprehensive test suite ensures reliability
1717- 🔒 ** Secure Base** : Built on official PostgreSQL Alpine images
18- - 📦 ** Latest Versions** : PostgreSQL 17 + PostGIS 3.5.3
18+ - 📦 ** Latest Versions** : PostgreSQL 18 + PostGIS 3.6.2
1919
2020### What's Included
2121
@@ -66,35 +66,88 @@ platform (AMD64 or ARM64).
6666
6767### Environment Variables
6868
69- | Variable | Description | Default |
70- | ---------------------| --------------------------------| ----------------------------|
71- | ` POSTGRES_PASSWORD ` | PostgreSQL password (required) | - |
72- | ` POSTGRES_USER ` | PostgreSQL username | ` postgres ` |
73- | ` POSTGRES_DB ` | Database name | ` postgres ` |
74- | ` PGDATA ` | Data directory | ` /var/lib/postgresql/data ` |
69+ | Variable | Description | Default |
70+ | ---------------------| --------------------------------| --------------------------------- |
71+ | ` POSTGRES_PASSWORD ` | PostgreSQL password (required) | - |
72+ | ` POSTGRES_USER ` | PostgreSQL username | ` postgres ` |
73+ | ` POSTGRES_DB ` | Database name | ` postgres ` |
74+ | ` PGDATA ` | Data directory | ` /var/lib/postgresql/18/docker ` |
7575
7676All standard PostgreSQL environment variables are supported. See
7777the [ official PostgreSQL Docker documentation] ( https://hub.docker.com/_/postgres ) for more details.
7878
79+ > ** Note:** Starting with PostgreSQL 18, the PGDATA path is now version-specific to enable easier
80+ > major version upgrades using ` pg_upgrade --link ` .
81+
7982### Using with Docker Compose
8083
8184``` yaml
82- version : ' 3'
85+ services :
86+ postgis :
87+ image : ghcr.io/clevercactus-dev/docker-lean-postgis:latest
88+ environment :
89+ POSTGRES_PASSWORD : mysecretpassword
90+ POSTGRES_DB : mydb
91+ ports :
92+ - " 5432:5432"
93+ volumes :
94+ - postgis-data:/var/lib/postgresql
95+
96+ volumes :
97+ postgis-data :
98+ ` ` `
99+
100+ ## 🔄 Migrating from PostgreSQL 17 to 18
101+
102+ PostgreSQL 18 introduces a breaking change in the data directory structure. If you're upgrading from
103+ a previous version of this image (PostgreSQL 17), you have two options:
104+
105+ ### Option 1: Use the Old PGDATA Path (Backwards Compatible)
106+
107+ Keep using your existing volumes by explicitly setting the PGDATA environment variable:
108+
109+ ` ` ` yaml
83110services :
84111 postgis :
85112 image : ghcr.io/clevercactus-dev/docker-lean-postgis:latest
86113 environment :
87114 POSTGRES_PASSWORD : mysecretpassword
88115 POSTGRES_DB : mydb
116+ PGDATA : /var/lib/postgresql/data # Use old location
89117 ports :
90118 - " 5432:5432"
91119 volumes :
92- - postgis-data:/var/lib/postgresql/data
120+ - postgis-data:/var/lib/postgresql/data # Old mount point
93121
94122volumes :
95123 postgis-data :
96124` ` `
97125
126+ ### Option 2: Migrate to the New Structure (Recommended)
127+
128+ For new deployments or when you want to benefit from easier future upgrades:
129+
130+ 1. **Backup your existing data:**
131+ ` ` ` bash
132+ docker exec your-container pg_dumpall -U postgres > backup.sql
133+ ```
134+
135+ 2 . ** Update your docker-compose.yml to use the new volume mount:**
136+ ``` yaml
137+ volumes :
138+ - postgis-data:/var/lib/postgresql # New mount point
139+ ` ` `
140+
141+ 3. **Start the new container and restore:**
142+ ` ` ` bash
143+ docker-compose up -d
144+ docker exec -i your-container psql -U postgres < backup.sql
145+ ```
146+
147+ > ** Why this change?** The new versioned PGDATA path (` /var/lib/postgresql/18/docker ` ) enables
148+ > faster major version upgrades using ` pg_upgrade --link ` by keeping data directories separate per
149+ > version.
150+
98151## 🔨 Building
99152
100153To build the image locally:
0 commit comments