Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Postgres bump from 15 to 16 if image: postgres in compose #164

Open
stanthewizzard opened this issue Sep 18, 2023 · 7 comments
Open

Comments

@stanthewizzard
Copy link

Steps to reproduce the behavior:

  1. update postgres
    bump from 15 to 16

  2. See error
    database was initiated with 15 and is incompatible with 16

In compose I change from
image: postgres
to
image: postgres:15.4-bullseye

@daniel31x13
Copy link
Member

Hello @stanthewizzard,
AFAIK there shouldn't be any restrictions on which postgres version you are using.

@stanthewizzard
Copy link
Author

after update ... doesn't work anymore in my case
I can revert to postfres and give it a try

@srozb
Copy link

srozb commented Sep 19, 2023

As the docker-compose is using latest tag of postgres and the postgres 16 is now the latest, postgres container will fail to run with the following error:

linkwarden-postgres-1  | 2023-09-19 13:34:48.347 UTC [1] FATAL:  database files are incompatible with server
linkwarden-postgres-1  | 2023-09-19 13:34:48.347 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 15, which is not compatible with this version 16.0 (Debian 16.0-1.pgdg120+1).

This is viable workaround:

# docker-compose.yml

image: postgres:15

@stanthewizzard
Copy link
Author

I'm already with this workaround
thanks :)

@stanthewizzard
Copy link
Author

stanthewizzard commented Sep 22, 2023

found it

In docker-compose.yml you could change

db-data:/var/lib/postgresql/data:rw
to this

db-data:/var/lib/postgresql@16/data:rw
Delete image and run

docker-compose up -d
one more time

@Sebastix
Copy link

As the docker-compose is using latest tag of postgres and the postgres 16 is now the latest, postgres container will fail to run with the following error:

linkwarden-postgres-1  | 2023-09-19 13:34:48.347 UTC [1] FATAL:  database files are incompatible with server
linkwarden-postgres-1  | 2023-09-19 13:34:48.347 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 15, which is not compatible with this version 16.0 (Debian 16.0-1.pgdg120+1).

This is viable workaround:

# docker-compose.yml

image: postgres:15

Applied the same change to fix:

2023-11-22 15:28:59.169 UTC [1] FATAL:  database files are incompatible with server
2023-11-22 15:28:59.169 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 15, which is not compatible with this version 16.1 (Debian 16.1-1.pgdg120+1).

@vnghia
Copy link

vnghia commented Nov 23, 2023

AFAIK, to upgrade a major postgres version, we will have to do it manually, either by dumping our database and reimporting it or using pg_upgrade. https://www.postgresql.org/docs/current/upgrading.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants