Reputation: 89
Can anyone help me please with this?
what I run:
docker run --name pgres --rm \
-e POSTGRES_USER=uzer \
-e POSTGRES_PASSWORD=1234 \
-e POSTGRES_DB=sample_db \
-p 5432:5432 postgres:14.1
even Nothing happens in the log:
waiting for server to shut down...2024-07-24 18:07:19.272 UTC [48] LOG: received fast shutdown request
.2024-07-24 18:07:19.273 UTC [48] LOG: aborting any active transactions
2024-07-24 18:07:19.275 UTC [48] LOG: background worker "logical replication launcher" (PID 55) exited with exit code 1
2024-07-24 18:07:19.275 UTC [50] LOG: shutting down
2024-07-24 18:07:19.284 UTC [48] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2024-07-24 18:07:19.396 UTC [1] LOG: starting PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-07-24 18:07:19.397 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-07-24 18:07:19.397 UTC [1] LOG: listening on IPv6 address "::", port 5432
2024-07-24 18:07:19.398 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-07-24 18:07:19.401 UTC [62] LOG: database system was shut down at 2024-07-24 18:07:19 UTC
2024-07-24 18:07:19.405 UTC [1] LOG: database system is ready to accept connections
Upvotes: -1
Views: 73
Reputation: 89
My bad; I had completely forgotten.
Tor was the problem, I turned it off and now the problem is solved.
Upvotes: 0
Reputation: 344
As you have the database in a container and the pgAdmin in another container, you cannot use "localhost" in the pgAdmin for trying to reach the database as "localhost" will be the container where pgAdmin is running.
Be sure both containers share the same network (Create a network and run both containers within -> https://docs.docker.com/engine/reference/run/#container-networking) and then, on pgAdmin interface instead of "localhost" use the name of the database container, that should fix the problem.
To run the postgres use:
docker run --name pgres --network my-net --rm -e POSTGRES_USER=uzer -e POSTGRES_PASSWORD=1234 -e POSTGRES_DB=sample_db -p 5433:5432 postgres:14.1
To run pgAdmin use:
docker run -p 80:80 --network my-net -e '[email protected]' -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' -d dpage/pgadmin4
Now you will be able to use pgres as server
Upvotes: 0