我创建了一个 docker 文件来创建一个 pgAdmin4 容器和一个 postgres 容器。
version: '3.8'
services:
postgres:
container_name: pg_container
image: postgres
restart: always
environment:
POSTGRES_USER: webquiver
POSTGRES_PASSWORD: webquiver
POSTGRES_DB: quiver_db
ports:
- "5432:5432"
pgadmin:
container_name: pgadmin4_container
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- "5050:80"
运行 docker compose up 时,我可以转到 localhost:5050 以访问 pgAdmin4 并使用我的凭据登录,您可以在代码中看到。但是当我使用服务器的下拉菜单时,它是空的。什么都没有被创造。而且我无法在那里创建任何服务器。它不允许我这样做。我得到错误:
Unable to connect to server:
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: Address not available
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
请帮忙。谢谢^^
问候