我正在设置我的django项目和postgres,但每次我收到此错误
角色不存在
或
Db不存在
因此,当我只尝试设置postgres并查看postgres是否正确创建用户和数据库时,但它不是
这是我的docker撰写文件:
version: "3"
services:
templates_db:
image: postgres:9.6
ports:
- "5432:5432"
environment:
- POSTGRES_USER=my_user
- POSTGRES_PASSWORD=my_pass
- POSTGRES_DB=my_db
volumes:
- ./data/postgres:/var/lib/postgresql/data
我使用docker-compose up --build
运行我的撰写文件并获得了以下日志
templates_db_1 | LOG: database system was interrupted; last known up at 2017-05-16 05:48:39 UTC
templates_db_1 | LOG: database system was not properly shut down; automatic recovery in progress
templates_db_1 | LOG: invalid record length at 0/14F0080: wanted 24, got 0
templates_db_1 | LOG: redo is not required
templates_db_1 | LOG: MultiXact member wraparound protections are now enabled
templates_db_1 | LOG: database system is ready to accept connections
templates_db_1 | LOG: autovacuum launcher started
当我以
身份登录postgres shell时docker exec -it **container_id** sh
su - postgres
$ psql
postgres=# \l
它没有我在撰写文件 my_db
中提到的数据库