【发布时间】:2019-03-13 14:47:10
【问题描述】:
在尝试打开 localhost:3000 时,我在使用 postgres 的 docker 中遇到以下问题
could not connect to server: Connection refused 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?
在我正在使用的 docker-compose 文件下方
version: '3'
volumes:
postgres_data: {}
services:
redis:
image: redis
command: redis-server
ports:
- "6379:6379"
app:
build:
context: .
dockerfile: /Users/admin/git/generic/myapp/docker/app/Dockerfile
depends_on:
- db
ports:
- 3000:3000
db:
image: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
web:
build:
context: .
dockerfile: /Users/admin/git/generic/myapp/docker/web/Dockerfile
depends_on:
- app
ports:
- 80:80
有人可以帮忙吗?
【问题讨论】:
-
什么试图连接到 Postgres 容器?
app容器? -
我在下面提到了 url
-
我需要删除postgreSql
-
或从compose中删除依赖于db
标签: ruby-on-rails docker docker-compose dockerfile