In an earlier blog post, I discussed running PostgreSQL in a container and noted the latest official image was bundled with a simple web-gui called “adminer“. If you’d rather run pgAdmin, I recommend taking a quick look at the docs at:
https://hub.docker.com/r/dpage/pgadmin4 which is the official image for pgAdmin
and
https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html which gives an overview of deploying the container.
I’ve discovered you can completely remove the “adminer” stanza from docker-compose.yaml. Here’s what worked for me:
version: '3.1'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: change_me
volumes:
- /home/drosser/fun/python-api-course/postgresql-docker/pg-data:/var/lib/postgresql/data
ports:
- 5432:5432
pgadmin:
image: dpage/pgadmin4:7
environment:
PGADMIN_DEFAULT_EMAIL: change_me@somedomain.zzz
PGADMIN_DEFAULT_PASSWORD: change_me
PGADMIN_LISTEN_PORT: 5050
volumes:
- /home/drosser/fun/python-api-course/postgresql-docker/pg-admin:/var/lib/pgadmin
ports:
- 5050:5050
After the containers have started, head to http://127.0.0.1:5050. Of course, this setup is completely without TLS (an SSL cert) and shouldn’t be used to serve pgAdmin to anyone other than the local host!
Leave a Reply