Upgrade Postgres 9.6-alpine data to 13.2-alpine

Hi,

I upgraded a while back from 9.5 to 9.6-alpine but cannot seem to get 9.6-alpine upgraded to 13.2-alpine.

Here is what I have tried:
Create a dump:
docker exec bayden10_db_1 /usr/bin/pg_dumpall -U postgres -f /var/lib/postgresql/data/dump.sql

produces an error:
OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: "/usr/bin/pg_dumpall": stat /usr/bin/pg_dumpall: no such file or directory: unknown

This dump procedure did work before upgrading from 9.5 to 9.6-alpine but I’m not able to dump or upgrade.

Any guidance with upgrading my existing DB from 9.6-alpine to 13.2-alpine would be appreciated.

~b10

I was able to dump with this method:

docker exec bayden10_db_1 /usr/local/bin/pg_dump -Fd postgres -U postgres -f /var/lib/postgresql/data/dump.sql

I then tried to upgrade by way of the following

docker-compose down cp -a db db.bak mv db/production/dump.sql . rm -r db/

nano docker-compose.yml

Change 9.6-alpine to 13.2-alpine

docker-compose up -d

Then I’m seeing error with authentication on the default db:

docker logs -f bayden10_db_1

2021-03-18 15:30:57.874 UTC [1] LOG: starting PostgreSQL 13.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit
2021-03-18 15:30:57.874 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
2021-03-18 15:30:57.874 UTC [1] LOG: listening on IPv6 address “::”, port 5432
2021-03-18 15:30:57.880 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2021-03-18 15:30:57.888 UTC [48] LOG: database system was shut down at 2021-03-18 15:30:57 UTC
2021-03-18 15:30:57.893 UTC [1] LOG: database system is ready to accept connections
2021-03-18 15:30:58.573 UTC [55] LOG: invalid length of startup packet
2021-03-18 15:31:06.198 UTC [56] FATAL: password authentication failed for user “postgres”
2021-03-18 15:31:06.198 UTC [56] DETAIL: Password does not match for user “postgres”.
Connection matched pg_hba.conf line 99: “host all all all md5”
2021-03-18 15:31:09.552 UTC [57] FATAL: password authentication failed for user “postgres”
2021-03-18 15:31:09.552 UTC [57] DETAIL: Password does not match for user “postgres”.
Connection matched pg_hba.conf line 99: “host all all all md5”

I then modified pg_hba.conf to

host all all all trust

This then allowed the default db start. How ever when upgrading from dump.sql

docker exec greenlight_db_1 /usr/local/bin/psql -U postgres -c “DROP DATABASE greenlight_production;”
DROP DATABASE

then

cp dump.sql db/production/
docker exec greenlight_db_1 /usr/local/bin/psql -U postgres -f /var/lib/postgresql/data/dump.sql

psql:/var/lib/postgresql/data/dump.sql: error: could not read from input file: Is a directory

Do I need to do a custom dump here?