Install PGAdmin4 on Docker

postgres docker database

Dec 31 2023 14:51

Docker image location from hub.docker.com

PgAdmin4 image link

Pull the latest version to local

docker pull dpage/pgadmin4

Create and run the container

docker run --name pgadmin \
-p 8050:80 \
-e "PGADMIN_DEFAULT_EMAIL=xxx@gmail.com" \
-e "PGADMIN_DEFAULT_PASSWORD=123456"  \
-d dpage/pgadmin4

Explain

--name pgadmin friendly container name, without this option container will create with a random generate name


-p 8050:80 Map pgadmin default web port 80 to your computer port 8050. After the container is up and running, your pgadmin will available at localhost:8050

PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD are the admin email and password. It uses for login when opening localhost:8050


-d dpage/pgadmin4 the image uses to create the container

Start using PGAdmin4 on web

After open localhost:8050 and login with PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD. PgAdmin dashboard is open, you can start adding your server and work on it


When your Postgress server is also a container on your machine. You need to set Host name/Address = host.docker.internal instead of localhost to access the database

me

Pham Duc Minh

Da Nang, Vietnam