To run pgAdmin on Docker Compose, you can follow these steps:
-
Install Docker and Docker Compose on your system if you haven’t already.
-
Create a
docker-compose.yml
file in a new directory and add the following contents to it:
version: '3'
services:
pgadmin:
image: dpage/pgadmin4
environment:
- PGADMIN_DEFAULT_EMAIL=pgadmin@example.com
- PGADMIN_DEFAULT_PASSWORD=secret
ports:
- "80:80"
This file defines a pgadmin
service that will be run using the dpage/pgadmin4
Docker image. It also sets the default email and password for the pgAdmin user, and exposes the pgAdmin web interface on port 80.
- In the same directory, run the following command to start the pgAdmin service:
docker-compose up -d
This command will start the pgadmin
service in the background.
-
To access the pgAdmin web interface, open a web browser and go to
http://localhost
. You should see the pgAdmin login page. Use the default email and password that you specified in thedocker-compose.yml
file to log in. -
Once you are logged in, you can use the pgAdmin interface to connect to a Postgresql database and manage it.
-
To stop the pgAdmin service, run the following command in the same directory:
docker-compose down
Go to browser and type ip/hostname of your docker compose host with port :80 like https://localhost:80. Enter the username and password which you have mention in docker compose yaml file.