Search code examples
postgresqldockerdocker-swarmpg-upgrade

Postgres - pg_upgrade 11 to 12 role "postgres" does not exist


When trying to upgrade from 11 to 12 by using https://github.com/tianon/docker-postgres-upgrade - the following error pops up:

docker run --rm \
        -e PGUSER=$POSTGRES_USER \
        -e POSTGRES_INITDB_ARGS="-U $POSTGRES_USER" \
        -v aip-pgs-data:/var/lib/postgresql/$OLD/data \
        -v aip-pg12-data:/var/lib/postgresql/$NEW/data \
        "tianon/postgres-upgrade:$OLD-to-$NEW"

LOGS:----

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

connection to database failed: FATAL:  role "postgres" does not exist

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

Any idea why this is happening? OR is that open bug.? what is the fix.?


Solution

  • Yes, once i passed POSTGRES_USER as env, then it's working fine. thank you