簡體   English   中英

如何在Docker上將Rails與Postgresql連接? 正在獲取:無法連接到服務器:連接被拒絕

[英]How to connect rails with postgresql on docker? Getting: could not connect to server: Connection refused

我遵循了本教程: https : //thoughtbot.com/blog/rails-on-docker

當我跑步...

docker-compose run web rake db:create db:setup

...我得到這個錯誤:

could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

而不是使用localhost127.0.0.1使用

蘋果電腦

使用docker.for.mac.host.internal

linux

嘗試https://stackoverflow.com/a/52858101/5616944

視窗

使用host.docker.internal

暫無
暫無

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

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