【发布时间】:2019-05-13 15:15:01
【问题描述】:
更新
我相信我通过此连接解决了这个问题...
db, err := gorm.Open("postgres", "host='postgres'&user:docker&port=5432&dbname='docker'&password='password'&sslmode=disable")
Docker PG 容器和 GoLang Scratch 容器之间的连接被拒绝。错误是:
============ exiting ==========
todo_1 | pq: SSL is not enabled on the server
todo_1 | panic: failed to connect database e
The main.go file which is panicking
Complete code base with Docker files
其他说明:
- 我正在使用 GORM 库连接 PG。
请求: 请查看代码并提供一些关于在何处以及如何解决此 SSL 问题的提示。
【问题讨论】:
-
您必须将相关代码放入您的问题中。链接非常适合添加详细信息,但问题必须独立完成。
-
您的 docker-compose.yml 文件没有为 Postgres 提供任何允许远程连接的设置。见blog.bigbinary.com/2016/01/23/…
标签: postgresql docker go docker-compose go-gorm