PostgreSQL · infra · fg-0278

postgres:latest container refuses to start with 'database files are incompatible with server'

If you see FATAL: database files are incompatible with server, the cause and the fix for PostgreSQL are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
FATAL: database files are incompatible with serverDETAIL: The data directory was initialized by PostgreSQL version 17, which is not compatible with this version 18.0.
Cause
The latest tag and other tags without a major version move to each new major release, and a data directory from one major version cannot be opened by the next without pg_upgrade or a dump and restore.
Fix
Pin the major version tag for any persistent volume and upgrade on purpose with pg_upgrade or pg_dumpall.
Apply
services: db: image: postgres:17 # pin the major, never latest with a persistent volume
Affected
Any major bump of the Docker Official Image, most recently 17 to 18 in September 2025
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun