I followed this tutorial: 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
use docker.for.mac.host.internal
try https://stackoverflow.com/a/52858101/5616944
use host.docker.internal
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.