I've been using the 12-alpine container of postgres for a long time on one of my server. Recently, all the images were removed and pulled so now the latest image I have is from 4 days ago. It seems the new version of 12-alpine is not compatible with the latest :disappointed:
So, I tried executing the command to backup the DB, but the container is exiting because of the incompatibility message. Is there a clean way to handle this situation? It seems I'll not be able to retrieve the old version of 12-alpine since the tag will only give me the latest.Postgres backup command: docker exec POSTGRES_CONTAINER pg_dumpall -U postgres > dump.sql
Error in my postgres container:
gitpostgres_1 | 2020-01-28 05:30:57.747 UTC [1] FATAL: database files are incompatible with server
gitpostgres_1 | 2020-01-28 05:30:57.747 UTC [1] DETAIL: The database cluster was initialized with CATALOG_VERSION_NO 201907221, but the server was compiled with CATALOG_VERSION_NO 201909212.
gitpostgres_1 | 2020-01-28 05:30:57.747 UTC [1] HINT: It looks like you need to initdb.
gitpostgres_1 | 2020-01-28 05:30:57.747 UTC [1] LOG: database system is shut down
Note I still have my data folder on the host machine. I just need to know how i can get to a state where i can export / dump all so that i can next restore
I think this was your version https://github.com/docker-library/postgres/commit/5ad8e92a81fec890f33eb077e491ea82c76ac980 12beta4
You can pull it by its sha256 hash
docker pull postgres@sha256:422f5e2ad999126f505b44c2d56abe726a08ed7e50e2d268e9906c879831805f
docker pull postgres@sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94
https://www.postgresql.org/developer/beta/
@wglambert Ah, it looks like maybe that image is not still being hosted. I was trying to find the old tag hash last night and i could not find it.
docker pull postgres@sha256:422f5e2ad999126f505b44c2d56abe726a08ed7e50e2d268e9906c879831805f
Error response from daemon: manifest for postgres@sha256:422f5e2ad999126f505b44c2d56abe726a08ed7e50e2d268e9906c879831805f not found: manifest unknown: manifest unknown
Here it is, 12-beta4-alpine
docker pull postgres@sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94
$ docker run -d --rm --name postgres-beta4 postgres@sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94
Unable to find image 'postgres@sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94' locally
sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94: Pulling from library/postgres
9d48c3bd43c5: Already exists
f112202a5fec: Pull complete
e2827e7bbe4a: Pull complete
c02d006ddf20: Pull complete
81bbbf517cba: Pull complete
bb629934ef6f: Pull complete
d5a103dae745: Pull complete
135dc04ce32f: Pull complete
Digest: sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94
Status: Downloaded newer image for postgres@sha256:74dbf54102221baabd97b31be9a44a52a9cec4217942d199f4f45d9ab24c2e94
1b5942df13b731ff05632911bdb08c079b00a10a09e2a4d63664ced1d95df161
$ docker exec postgres-beta4 cat /usr/local/include/postgresql/server/catalog/catversion.h | grep CATALOG_VERSION_NO
#define CATALOG_VERSION_NO 201907221
$ docker run -d --rm --name postgres-latest postgres:latest
68f44b1892261245bfb7804f3462110052f5094800ce9779280e012c87ee00d1
$ docker exec postgres-latest cat /usr/share/postgresql/12/catalog_version
201909212
I'm not sure of the upgrade path you have to take, if it's beta4->rc1 or beta4->ga
https://www.postgresql.org/about/news/1975/
To upgrade to PostgreSQL 12 RC 1 from Beta 4 or an earlier version of PostgreSQL 12, you will need to use a strategy similar to upgrading between major versions of PostgreSQL (e.g. pg_upgrade or pg_dump / pg_restore). For more information, please visit the documentation section on upgrading.
Closing since this is resolved
@wglambert sorry did not get to check the thread the last couple of days. This new image works for me. Thank you so much!
I have meet the same problem too, my version is postgres:13-alpine, but after a few month later, I can't start this postgres.
PostgreSQL Database directory appears to contain a database; Skipping initialization
2020-11-09 09:17:35.840 UTC [1] FATAL: database files are incompatible with server
2020-11-09 09:17:35.840 UTC [1] DETAIL: The database cluster was initialized with CATALOG_VERSION_NO 202005171, but the server was compiled with CATALOG_VERSION_NO 202007201.
2020-11-09 09:17:35.840 UTC [1] HINT: It looks like you need to initdb.
2020-11-09 09:17:35.841 UTC [1] LOG: database system is shut down
I have no idea how to fix this problem, it's running in my k8s銆俉ould you please give some suggestions?Thanks.
@theWayToAI, postgres should be compatible for database files within a major version, but not for a pre-release. Likely you were using postgres:13-alpine when 13 was still pre-release. The release was only add here in https://github.com/docker-library/postgres/commit/8d281112a872380578e37a92a698ce59d66473d7 and pushed to the Docker Hub with https://github.com/docker-library/official-images/pull/8770. I would guess the "simplest" solution would be to dump and restore.
Thanks. I've solve this problem. If possible, I sugesst that the docker tag should be postgres:13-alpine-rc , then this problem will never happen.
Tags: 13-rc1-alpine, 13-alpine
They were also tagged with -rc1.
I've filed https://github.com/docker-library/postgres/pull/797 to help alleviate this in the future.