Postgres-pg_upgrade 11到12角色“ postgres”不存在

时间:2019-11-08 08:07:22

标签: postgresql docker docker-swarm pg-upgrade

当尝试使用https://github.com/tianon/docker-postgres-upgrade从11升级到12时-弹出以下错误:

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"

日志:----

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

知道为什么会这样吗?还是那个开放的错误?解决方法是什么?

1 个答案:

答案 0 :(得分:0)

是的,一旦我通过POSTGRES_USER作为env,那么它就可以正常工作。谢谢