1 min read
How to restore a PostgreSQL 17 backup to a Docker container | by Matija Žiberna | December 2024
Learn some simple commands to restore your Postgres 17 database
If you need to restore a PostgreSQL database to a running Docker container, this guide will walk you through the process.
This guide assumes that you have a backup database stored in a file.
/home/matija/back_scraper_saas_18_2_2024.sql
To get started, we need the container ID and database credentials we want to restore. This process is an in-place restore, which means we restore the database directly to its current location. You can find the container ID by running the command docker ps
order.
For me it was: 0dc49acc42d8
Next, we need to find the database credentials. You can extract them from your login URI:
postgresql://admin:dummyPass@127.0.0.1:5432/scraper_saas?schema=public
We are mainly interested in the user and the database name.