Docker Compose installation of Postgres 12.4, PostGIS, 3.0, PgAdmin

PostGIS Docker setup using docker-compose

Postgres, PostGIS, PgAdmin

These three P's go hand in hand in my daily coding life.  I thought I would share the fastest setup that I know to get all three up in running in any environment (Windows, Linux, Mac).

First lets start off with the question you might have asked yourself when you found this post.
How to setup PostGIS, Postgres and PgAdmin docker containers with persistent volumes? 

This basically means you want to have a functioning Postgres database with the PostGIS extension enabled.  You also want the database to continue to exist after you shut down or stop the docker container.  Then you want to visually administer the Postgres database using PgAdmin to maybe create a database, manage users or even load data.

For those of you who just want answers, here is the short answer and the prerequisites you must meet before running this single command. The requirements include installing Docker and docker-compose on your local machine.  That's it, nothing else needed.

Now simply save this docker-compose.yml file (posted here below) locally and run the following command at in your local terminal:

docker-compose up -d




Now for some more details.  The base image you are using comes from Kartoza/postgis and it can and should be tuned for your needs.  The setup above is a quick start and not tuned for production environments.  The PgAdmin container is also straight out of the box so use with care.

I hope this helped you. Until next time, happy coding.

Michael

Comments

Popular Posts