Home > Software design >  data directory was initialized by PostgreSQL version 13, which is not compatible with this version 1
data directory was initialized by PostgreSQL version 13, which is not compatible with this version 1

Time:10-05

I have downloaded Portainer onto my server and created a PostgreSQL database in a container there. Today I could no longer get access to the database. The log shows a message that there is a version problem.

I already read into some similar issues like Postgres container crashes with `database files are incompatible with server` after container's image has been updated to the latest one and Postgres container crashes with `database files are incompatible with server` after container's image has been updated to the latest one

and the solutions brew postgresql-upgrade-database did not work.

What can I do?

LOG

2021-10-03  [1] FATAL:  database files are incompatible with server
2021-10-03  [1] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.0 (Debian 14.0-1.pgdg110 1).

PostgreSQL Database directory appears to contain a database; Skipping initialization

I also found this https://www.postgresql.org/docs/14/upgrading.html but the commands didn't work. Do I need to do this in the container somehow, or what commands will work to keep it running in the container?

CodePudding user response:

I resolved it by

  1. Removing the postgres image
  2. Remove the volume
  3. Pull the image again

Assuming you know the docker commands for above step.

CodePudding user response:

I was also facing the same issue with postgres in keycloak. Downgrading the version to 13 resolved my issue.

  • Related