Install PGAdmin4 on Docker
Dec 31 2023 14:51
Docker image location from hub.docker.com
![](https://pdminhdevcloudstorage.blob.core.windows.net/post/pgadmin-dockerhub_1667203389420_145397196.png)
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
![](https://pdminhdevcloudstorage.blob.core.windows.net/post/docker-ps_1667204578252_145421591.png)
-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
![](https://pdminhdevcloudstorage.blob.core.windows.net/post/pgadmin-login_1667204672341_145450570.png)
-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
![](https://pdminhdevcloudstorage.blob.core.windows.net/post/pgadmin-ready_1667205090847_145476502.png)
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
![](https://pdminhdevcloudstorage.blob.core.windows.net/post/docker-internal_1667205518152_145509932.png)
Delete comment
Confirm delete comment
![me](/images/me.jpg)
Pham Duc Minh
Da Nang, Vietnam