tianon / docker-postgres-upgrade

a PoC for using "pg_upgrade" inside Docker -- learn from it, adapt it for your needs; don't expect it to work as-is!
https://hub.docker.com/r/tianon/postgres-upgrade/
MIT License
1.09k stars 116 forks source link

wont start - fails to find socket of source postgres #65

Closed ITJamie closed 2 years ago

ITJamie commented 2 years ago
docker run --rm \
    -v /srv/appname/data/postgres:/var/lib/postgresql/10 \
    -v /srv/appname/data/postgres12:/var/lib/postgresql/12 \
    tianon/postgres-upgrade:10-to-12 

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok

*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.

connection to database failed: connection to server on socket "/var/lib/postgresql/.s.PGSQL.50432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

could not connect to source postmaster started with the command:
"/usr/lib/postgresql/10/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/postgresql/10/data" -o "-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/postgresql'" start
Failure, exiting

Any ideas of next troubleshooting step? Ive confirmed all the files in /srv/appname/data/postgres are owned by uid 1001. ive tried the 10-14 image and it was the same error Ive also tried adding "data" to the volume mounts but the same issue occurs, if i put in an incorrect path it warns that it cant find the PG_VERSION file, so its definitely seeing the data:

docker run --rm \
    -v /srv/appname/data/postgres/data:/var/lib/postgresql/10/data \
    -v /srv/appname/data/postgres12/data:/var/lib/postgresql/12/data \
    tianon/postgres-upgrade:10-to-12 
ITJamie commented 2 years ago

just a note. the source postgres container data dir was a https://hub.docker.com/r/bitnami/postgresql container

ITJamie commented 2 years ago

so it turns out the bitnami data folder doesnt contain a postgres.conf file or a pg_hba file. they move those elsewhere and are customised. sigh