Skip to content

Instantly share code, notes, and snippets.

@wolfymaster
Created August 18, 2021 02:47
Show Gist options
  • Select an option

  • Save wolfymaster/17aefe0993000f140531109fa17ee32a to your computer and use it in GitHub Desktop.

Select an option

Save wolfymaster/17aefe0993000f140531109fa17ee32a to your computer and use it in GitHub Desktop.
Springboard-Postgres
# Quickly boot up a postgres container and create a database to use for testing student assessments
#!/bin/bash
# run postgres container
docker run -d --name postgres_sb -e POSTGRES_PASSWORD=password -p 5432:5432 postgres:latest
# wait for container to start
sleep 3
# Ask for db name
read -p "dbname: " dbname
# create db
echo "Creating database.. $dbname"
docker exec -it postgres_sb psql -U postgres -c "create database \"$dbname\""
echo "Connect to database using: postgres://postgres:password@localhost/$dbname"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment