簡體   English   中英

無法連接到windows10上的postgres

[英]can't connect to postgres on windows10

我正在我的Windows PC上設置項目,我遇到了postgres的問題。 項目設置在docker上。 當我運行docker-compose up我收到錯誤

: *** Failed to connect to database dev; trying to create database    
/usr/local/bundle/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:224:in `initialize': PG::ConnectionBad: could not connect to server: Connection refused (Sequel::DatabaseConnectionError)
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

我不知道該怎么辦。 我已經為TCP-IP安裝了microsoft easy-fix,關閉了windows防火牆,將pg_hba.conf所有連接都更改為信任。 什么都沒有幫助。 我沒有安裝任何防病毒軟件。

nmap報告:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.0027s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 995 closed ports
PORT     STATE SERVICE
135/tcp  open  msrpc
445/tcp  open  microsoft-ds
2068/tcp open  avocentkvm
2179/tcp open  vmrdp
5432/tcp open  postgresql

編輯:我運行psql -h localhost並收到

psql: CATASTROPHIC: role "Kamil" does not exist

卡米爾是我的電腦名稱。

EDIT2:

是否有可能docker無法訪問localhost上的postgres?

問題解決了

我必須將環境var設置為DB_HOST=docker.for.win.localhost

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM