我正在使用django-cookiecutter模板,并且第二次使用新项目。它无法连接到postgres并出现以下错误:
postgres_1 | 2018-04-30 14:54:09.747 UTC [1] LOG: database system is ready to accept connections
postgres_1 | 2018-04-30 14:54:10.029 UTC [28] FATAL: password authentication failed for user "IViLGLIEWLBDGBnsAuoOEhtFaKrqKxfX"
postgres_1 | 2018-04-30 14:54:10.029 UTC [28] DETAIL: Role "IViLGLIEWLBDGBnsAuoOEhtFaKrqKxfX" does not exist.
postgres_1 | Connection matched pg_hba.conf line 95: "host all all all md5"
django_1 | PostgreSQL is unavailable (sleeping)...
其中一位维护者解释了这一点:
the thing is, every time you bootstrap the project POSTGRES_USER and POSTGRES_PASSWORD get reset to a newly-generated random values
我试图删除所有的docker容器,但没有成功,知道我怎么能解决这个问题?我没有旧凭据来替换它们。
答案 0 :(得分:2)
在https://github.com/webyneter(django-cookiecutter的贡献者)
的帮助下解决方案如下:
docker volume ls
docker volume rm <your project_slug>_postgres_backup_local <your project_slug>_postgres_data_local