繁体   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