DMDB pgAdmin & PostgreSQL for Docker
docker-compose.yml
modified from khezen/compose-postgres.
Setup
- Install Docker and Docker-Compose
- Download the
docker-compose.yml
file - run
docker volume create pgdata
anddocker volume create pgadmin
to create the volumes
Using
- Open the command-line and navigate to the directory where you have the
docker-compose.yml
file - run
docker-compose up -d
to start the app - Go to
localhost:5050
with your favourite browser. - log-in with E-Mail
dmdb@example.com
and Passwordadmin
- On the dashboard, click on
Add New Server
- Give the server any name, and go to the Connection tab. As the hostname, use
postgres
, username and role arepostgres
as well, and the password ispassword
. Click on Save to connect to the server. - Navigate to the database you just created and click on Tools in the navbar and then on Query Tool.
- Now you can use the SQL prompt window!
Stopping the application
To stop the application, just enter docker-compose down
in the terminal, when you are in the folder with the docker-compose.yml
file.
Restarting again
Just follow the steps in the Using chapter to use the app to any later point again. Thanks to the docker volumes, the databases will be persistens even when you shut down Postgres.
Removing the containers
If you want to remove the containers, stop the application and use docker container prune
and confirm to remove the containers.
Removing the image
Use docker images
to list all images, and docker rmi IMAGE_ID
where IMAGE ID
is the id of the image (fenglc/pgadmin4) from the list command.
Removing the volumes
Use docker volume remove pgdata
and docker volume remove pgadmin
to remove the volumes