简体   繁体   中英

Cannot connect to port 8080 adminer (Postgres+Adminer docker stack)

Problem

Following the postgres docker official page: https://hub.docker.com/_/postgres

I've created "stack.yml" and it's contain:

# 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

And then running command:

$ docker stack deploy -c stack.yml postgres

But after it is finished, I cannot open http://localhost:8080

管理员卡住

it keep "Waiting for ..."

I followed everything from the docs, and keep retrying but keep failing, any help would be very appreciated?

update:

using docker-compose is working, but I'm still curious why running with docker stack ... won't work

Additional details

Software version:

Pop!_OS 20.04 LTS
Docker version 19.03.12, build 48a66213fe

Here is $ 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

Here is $ 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 

Here is docker logs for postgres:

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

Here is docker logs for adminer:

[Tue Sep  8 06:21:01 2020] PHP 7.4.10 Development Server (http://[::]:8080) started

使用IP地址而不是hostname

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM