Pgadmin does not start with docker-compose-file

Viewed 271

I started working with postgres and discovered pgadmin. I started like this:

Postgres:

$ docker run --name admin -e POSTGRES_PASSWORD=admin -p 5432:5432 -d postgres:latest

Pgadmin:

  docker run -p 5050:80  -e "PGADMIN_DEFAULT_EMAIL=admin@admin.com" -e "PGADMIN_DEFAULT_PASSWORD=root"  -d dpage/pgadmin4

So this worked perfectly fine, I started the postgres container and afterwarda the pgadmin cointainer and got on the site http://localhost:80/login and could login

The problem now is the docker-compose.yml that I wrote. As I deploy my docker-compose-file, the containers are both running but I can't access the login page of pgadmin

Docker-compose.yml:

version: '3.8'
services:
  db:
    image: postgres:latest
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: admin
    ports:
      - "5432:5432"
  pgadmin:
    image: dpage/pgadmin4:latest
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: root
    ports:
      - "5050:80"
1 Answers

When I run it, it works as it should. So I think your issue is the URL you try to access it on. You need to access it on the mapped port 5050. Not 80, as you've written. So the URL is http://localhost:5050/login.

Related