这是compose文件中的相关部分:
pg: image: postgres:10 volumes: - db-data:/var/lib/postgresql/data environment: POSTGRES_DB: user-auth POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres
这是日志:
Attaching to userauth_pg_1pg_1 | 2018-02-05 18:05:54.803 UTC [1] LOG: Listening on IPv4 address "0.0.0.0",port 5432pg_1 | 2018-02-05 18:05:54.803 UTC [1] LOG: Listening on IPv6 address "::",port 5432pg_1 | 2018-02-05 18:05:54.806 UTC [1] LOG: Listening on Unix socket "/var/run/postgresql/.s.PGsql.5432"pg_1 | 2018-02-05 18:05:54.817 UTC [24] LOG: database system was interrupted; last kNown up at 2018-02-05 18:03:26 UTCpg_1 | 2018-02-05 18:05:54.942 UTC [24] LOG: database system was not properly shut down; automatic recovery in progresspg_1 | 2018-02-05 18:05:54.944 UTC [24] LOG: redo starts at 0/1633ED0pg_1 | 2018-02-05 18:05:54.944 UTC [24] LOG: invalID record length at 0/1633F08: wanted 24,got 0pg_1 | 2018-02-05 18:05:54.944 UTC [24] LOG: redo done at 0/1633ED0pg_1 | 2018-02-05 18:05:54.955 UTC [1] LOG: database system is ready to accept connectionspg_1 | 2018-02-05 18:05:59.140 UTC [31] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:06:15.528 UTC [32] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:08:46.120 UTC [33] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:08:46.151 UTC [34] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:02.138 UTC [35] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:02.926 UTC [36] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:04.244 UTC [37] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:04.273 UTC [38] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:04.602 UTC [39] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:04.910 UTC [40] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:05.777 UTC [41] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:05.823 UTC [42] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:05.878 UTC [43] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:06.663 UTC [44] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:14:06.716 UTC [45] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:16:32.713 UTC [46] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:47:04.603 UTC [47] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 18:51:34.413 UTC [1] LOG: received smart shutdown requestpg_1 | 2018-02-05 18:51:34.417 UTC [1] LOG: worker process: logical replication launcher (PID 30) exited with exit code 1pg_1 | 2018-02-05 18:51:34.419 UTC [25] LOG: shutting downpg_1 | 2018-02-05 18:51:34.434 UTC [1] LOG: database system is shut downpg_1 | 2018-02-05 19:08:42.934 UTC [1] LOG: Listening on IPv4 address "0.0.0.0",port 5432pg_1 | 2018-02-05 19:08:42.934 UTC [1] LOG: Listening on IPv6 address "::",port 5432pg_1 | 2018-02-05 19:08:42.937 UTC [1] LOG: Listening on Unix socket "/var/run/postgresql/.s.PGsql.5432"pg_1 | 2018-02-05 19:08:42.951 UTC [25] LOG: database system was shut down at 2018-02-05 18:51:34 UTCpg_1 | 2018-02-05 19:08:42.956 UTC [1] LOG: database system is ready to accept connectionspg_1 | 2018-02-05 19:09:04.316 UTC [32] FATAL: database "user-auth" does not existpg_1 | 2018-02-05 19:09:18.081 UTC [33] FATAL: database "user-auth" does not exist解决方法 您最有可能在没有设置env变量的情况下启动容器.
然后在没有用户或DB信息的情况下初始化db.
您需要删除该卷,然后重试.
信用:https://github.com/docker-library/postgres/issues/453#issuecomment-393939412
总结以上是内存溢出为你收集整理的postgresql – Postgres图像不是创建数据库全部内容,希望文章能够帮你解决postgresql – Postgres图像不是创建数据库所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)