Skip to content

avalatea/local-docker-postgres

 
 

Repository files navigation

This is a simple docker compose setup to create a temporary database using docker. Using a temporary database has the advantage of making it easy to bring up and tear down a database without the overhead that comes with creating a temporary databse locally.

Instructions

  1. Copy everything from config_templates onto the root directory.
cp -r ./config_templates/{.,}* .
  1. Fill in information in the newly copied over .env file from the database containing the data you would like to copy to your local.

  2. Run docker compose.

# This might cause errors if you exit and run it a second time. If the errors indicate that a pg_restore had already been done previously, this is mostly harmless.
docker compose up

# Alternately, you can just run to prevent pg_restore from rerunning.
docker compose up temp_instance
  1. Optionally, you can view the database in pgadmin by connecting to this server using the credentials supplied in .env. The following assumes you did not modify the defaults from .env:
Name: anything you'd like
Host name/addess: localhost
Port: 5432
# must be the same as CLOUD_DBNAME
Maintainence database:
Username: username
Password: password

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 79.5%
  • Dockerfile 20.5%