gpt4 book ai didi

database - Postgres服务不断重启

转载 作者:行者123 更新时间:2023-12-02 19:48:57 25 4
gpt4 key购买 nike

我正在使用postgres服务运行以下docker compose:

version: "3"
services:
db:
image: postgres:latest
restart: always
container_name: dev_db
environment:
- POSTGRES_HOST_AUTH_METHOD = trust
ports:
- 5435:5432
volumes:
- dev_data:/var/lib/postgresql/data
- ./dbscripts/postgres:/docker-entrypoint-initdb.d
volumes:
dev_data:

但是,我的容器不断重启,当检查日志时,我收到以下消息:
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD to a non-empty value for the
superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
connections without a password. This is *not* recommended.
See PostgreSQL documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html

有人知道这个问题的根源吗?

最佳答案

我认为docker无法读取您的环境变量,因为它的设置不正确。正确的语法是

environment:
- "POSTGRES_HOST_AUTH_METHOD=trust"

关于database - Postgres服务不断重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62050004/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com