2022-11-07 11:02:12.935 UTC [26] LOG: record with incorrect prev-link 1E00000/0 at 0/898C440

2022-11-07 11:02:12.935 UTC [26] LOG: invalid primary checkpoint record

2022-11-07 11:02:12.935 UTC [26] PANIC: could not locate a valid checkpoint record

2022-11-07 11:02:15.678 UTC [27] FATAL: the database system is starting up

2022-11-07 11:02:20.679 UTC [28] FATAL: the database system is starting up

2022-11-07 11:02:22.892 UTC [1] LOG: startup process (PID 26) was terminated by signal 6: Aborted

2022-11-07 11:02:22.892 UTC [1] LOG: aborting startup due to startup process failure

2022-11-07 11:02:22.946 UTC [1] LOG: database system is shut down

The fix:

docker run -it --rm --volume BLOGSTACK_postgresql_prod_data_dir:/var/lib/postgresql/data postgres:12.1 bash

su - postgres -c '/usr/lib/postgresql/12/bin/pg_resetwal -f /var/lib/postgresql/data'

link