[英]Remotely connect to Database in Container from Host Machine?
我想你所說的“GUI 應用程序”是指像 PgAdmin 或你最喜歡的 IDE 這樣的 postgres 客戶端?
您只需要配置您的客戶端數據源,正如我們在您的日志中看到的那樣,我的意思是:
host : localhost
port : 5432 (or the one mapped in your docker-compose.yml file)
database : It's not "monitor" as it doesn't find it !
user and password : in your docker-compose.yml too. Visibly it's not "root" as id doesn't find it.
您的 docker-compose.yml 應該是您項目的根目錄。
如果您的 docker-compose 中缺少它,您可以添加它:
version: "3.7"
services:
main:
image: postgres:12.7-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
- POSTGRES_DB=monitor
此致。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.