简体   繁体   English

如何在Docker上将Rails与Postgresql连接? 正在获取:无法连接到服务器:连接被拒绝

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

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

When I run ... 当我跑步...

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

... I get this error: ...我得到这个错误:

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?

instead of using localhost or 127.0.0.1 use 而不是使用localhost127.0.0.1使用

Mac 苹果电脑

use docker.for.mac.host.internal 使用docker.for.mac.host.internal

linux linux

try https://stackoverflow.com/a/52858101/5616944 尝试https://stackoverflow.com/a/52858101/5616944

Windows 视窗

use host.docker.internal 使用host.docker.internal

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails db:create using PostgreSQL return PG::ConnectionBad: 无法连接到服务器:连接被拒绝 - Rails db:create using PostgreSQL return PG::ConnectionBad: could not connect to server: Connection refused 无法连接到服务器:连接被拒绝 - could not connect to server: Connection refused Cloud9中的postgresql错误“无法连接到服务器:连接被拒绝” - postgresql error in Cloud9 “could not connect to server: Connection refused” Rails本地服务器未运行:无法连接到服务器:连接被拒绝 - Rails local server doesnt run : could not connect to server: Connection refused Heroku Rails部署失败,并显示错误“无法连接到服务器:连接被拒绝” - Heroku Rails deploy fails with error “could not connect to server: Connection refused” Rails-Postgres-无法连接到服务器:连接被拒绝(PG :: ConnectionBad) - Rails - Postgres - could not connect to server: Connection refused (PG::ConnectionBad) heroku迁移,无法连接到服务器:连接被拒绝 - heroku migration, getting could not connect to server: Connection refused PG ::错误:无法连接到服务器:连接被拒绝 - PG::Error: could not connect to server: Connection refused PG :: ConnectionBad:无法连接到服务器:连接被拒绝 - PG::ConnectionBad: could not connect to server: Connection refused PG::ConnectionBad - 无法连接到服务器:连接被拒绝 - PG::ConnectionBad - could not connect to server: Connection refused
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM