Docker Pgadmin 4

Arya picture Arya · Jan 1, 2018 · Viewed 14.4k times · Source

EDIT

Turned out to a problem with the image, I tried another one and it works fine


I'm trying to run Pgadmin 4 as server mode using Docker on Debian 9. I have followed the instructions on https://hub.docker.com/r/dpage/pgadmin4/ I start it by the following command

docker run -p 5050:5050 -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=a12345678" -d  dpage/pgadmin4

I don't get any errors, and docker ps shows the status as below

root@poweredge:~# docker ps
CONTAINER ID        IMAGE               COMMAND                 CREATED             STATUS              PORTS                                     NAMES
c4b11e4bceb7        dpage/pgadmin4      "/bin/bash /entry.sh"   12 seconds ago      Up 10 seconds       80/tcp, 443/tcp, 0.0.0.0:5050->5050/tcp   upbeat_jackson

But when I go to serverip:5050 nothing loads. Any idea what the problem may be here?

On the local machine when I execute curl http://localhost:5050 I get Connection reset by peer if the docker instance is running

root@poweredge:~# curl http://localhost:5050
curl: (56) Recv failure: Connection reset by peer

if I stop the Docker instance, I get

root@poweredge:~# curl http://localhost:5050
curl: (7) Failed to connect to localhost port 5050: Connection refused

Answer

Anuruddha picture Anuruddha · Jan 1, 2018

PgAdmin 4 docker container has exposed port 80 and 443 by default. You can checck the Dockerfile here https://github.com/postgres/pgadmin4/blob/master/pkg/docker/Dockerfile

So the port mapping parameter in the command has to be updated (-p host_port: container_port)

Below is the updated command to access pgadmin4 via http (port 80)

docker run -p 5050:80 -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=a12345678" -d dpage/pgadmin4

After starting the container you should be able to access it via http://localhost:5050