DEV Community

Cover image for Spin up a PostGres Docker Container on the Raspberry Pi in 2 minutes! 🐳
Rohan Sawant
Rohan Sawant

Posted on

Spin up a PostGres Docker Container on the Raspberry Pi in 2 minutes! 🐳

Installing things is difficult! But, it does not need to be.
Tobias and me (mostly just Tobias) have already made this easy for you.

This is a Docker Starter Pack thingy to help you up a PostGreSQL Database on your Raspberry Pi within seconds.

🐳

Note, this assumes that you have a gentle grasp of what Docker Compose and Containerization are, so stay put for the rodeo!

View it on Github

Setup

  1. Install Docker and Docker Compose on the Raspberry Pi
  2. Clone the repo which contains the Compose file git clone https://github.com/CT83/Raspberry-Pi-PostGres-Docker-Compose.git
  3. Checkout the postgresql.conf, and configure listen_addresses accordingly. By default, the container will be open to all users on the port 5432.
  4. Up the container. sudo docker-compose up --build -d

The container is at :5432 with password password@7979. You can change this in the docker-compose.yml.
Now, you can treat this like a full fledged PostGres server and do your PG-Admin Stuff. πŸ˜‡

The PostGres Server can be accessed by any device on the network!
Use this to build a truly decentralized off-site infrastructure where each container runs on a separate low powered Raspberry Pi Zero, maybe?

Credits

This would have been impossible without the base image created by Tobias H.
I just added the docker-compose and a conf to allow other network hosts to connect to it
You can check it out here

Top comments (0)