The official PostgreSQL Docker image doesn't provide a way to handle version upgrades, often requiring complex manual steps. This Docker image solves that problem by automating the entire process. It automatically detects the version of your existing PostgreSQL data directory and performs a fast, in-place upgrade using pg_upgrade with the --link option, minimizing downtime and disk space usage. Always back up your data before proceeding, as this tool modifies your database files directly.
It offers several powerful features to fit different workflows:
initContainer.services:
db:
image: pgautoupgrade/pgautoupgrade:latest
container_name: pgautoupgrade
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- ./postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_super_secret_password
POSTGRES_DB=my_databaseAuto-fetched about 10 hours ago
Auto-fetched about 10 hours ago