What is the problem?
The provided Docker Compose configuration for Postgres is incompatible with Postgres 18 and newer. The issue occurs because Postgres 18 changed the default data directory inside the official Docker image. Previously, the data directory was located at /var/lib/postgresql/data, but starting with Postgres 18 it is now /var/lib/postgresql/.
Operating System
Linux
Architecture Version (x86, x64, arm, etc)
x64
Steps to reproduce
- Create or use the provided
docker-compose.yml with the Postgres service
- Start the containers
- Observe that the Postgres container keeps restarting and fails to start
Relevant log output