Frictionless Local Postgres with Docker Compose

PostgreSQL is a very powerful open source database that is available everywhere from a developer laptop to cloud providers. I have been using PostgreSQL for decades starting in 1998. I am always looking for ways to optimize my dev workstation configuration.

PgAdmin 4 is the graphical interface for working with Postgres. It is is a single page web application written in JavaScript that talks to a backend written in python. Using docker-compose it is possible to run both pgAdmin and postgres inside docker, as shown in the diagram below.

final configuration: apps, containers, virtual machines on a developer workstation

Because pgAdmin runs as a server it asks for a username/password to access the UI. After logging in to pgAdmin you have to setup a connection to the database that you want administer. The login and connection setup are annoying when developing locally.

Setting up pgAdmin with pre-configured connectivity and passwords is tricky. It requires in depth understanding of docker, docker-compose, shell scripting, and how pgAdmin works. I put together an example implementation at https://github.com/asaikali/docker-compose-postgres with all the gory technical details explained in the repository’s readme.md file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.