gpt4 book ai didi

postgresql - 无法连接到端口8080管理员(Postgres + Adminer Docker堆栈)

转载 作者:行者123 更新时间:2023-12-02 19:45:18 25 4
gpt4 key购买 nike

问题
遵循postgres docker官方页面:
https://hub.docker.com/_/postgres
我创建了“stack.yml”
它包含:

# Use postgres/example user/password credentials
version: '3.1'

services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: example

adminer:
image: adminer
restart: always
ports:
- 8080:8080
然后运行命令:
$ docker stack deploy -c stack.yml postgres
但是完成后,我无法打开http:// localhost:8080
adminer stuck
它一直在“等待...”
我遵循了文档中的所有内容,并继续重试,但仍然失败,对您有所帮助吗?
更新:
使用 docker-compose可以正常工作,但是我仍然很好奇为什么 docker stack ...无法运行
额外细节
软件版本:
Pop!_OS 20.04 LTS
Docker version 19.03.12, build 48a66213fe
这是 $ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
f0fa7f4ce6ef postgres:latest "docker-entrypoint.s…" 23 minutes ago Up 23 minutes 5432/tcp postgres_db.1.pq28sm95br3hhr92gvxpsrgwd
4a8b54019f7d adminer:latest "entrypoint.sh docke…" 23 minutes ago Up 23 minutes 8080/tcp postgres_adminer.1.kya7f232pjc4975ubj9ywa13x
这是 $ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
j7mxwf0rpi7g postgres_adminer replicated 1/1 adminer:latest *:8080->8080/tcp
we8izke0tb34 postgres_db replicated 1/1 postgres:latest
这是postgres的 docker logs:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok


Success. You can now start the database server using:

pg_ctl -D /var/lib/postgresql/data -l logfile start

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2020-09-08 06:21:18.981 UTC [46] LOG: starting PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2020-09-08 06:21:18.982 UTC [46] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-09-08 06:21:18.994 UTC [47] LOG: database system was shut down at 2020-09-08 06:21:18 UTC
2020-09-08 06:21:18.997 UTC [46] LOG: database system is ready to accept connections
done
server started

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2020-09-08 06:21:19.074 UTC [46] LOG: received fast shutdown request
waiting for server to shut down....2020-09-08 06:21:19.075 UTC [46] LOG: aborting any active transactions
2020-09-08 06:21:19.076 UTC [46] LOG: background worker "logical replication launcher" (PID 53) exited with exit code 1
2020-09-08 06:21:19.077 UTC [48] LOG: shutting down
2020-09-08 06:21:19.090 UTC [46] LOG: database system is shut down
done
server stopped

PostgreSQL init process complete; ready for start up.

2020-09-08 06:21:19.186 UTC [1] LOG: starting PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2020-09-08 06:21:19.186 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-09-08 06:21:19.186 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-09-08 06:21:19.188 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-09-08 06:21:19.216 UTC [55] LOG: database system was shut down at 2020-09-08 06:21:19 UTC
2020-09-08 06:21:19.219 UTC [1] LOG: database system is ready to accept connections
这是管理员的 docker logs:
[Tue Sep  8 06:21:01 2020] PHP 7.4.10 Development Server (http://[::]:8080) started

最佳答案

使用IP地址代替hostname

关于postgresql - 无法连接到端口8080管理员(Postgres + Adminer Docker堆栈),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63788555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com