Created
August 18, 2021 02:47
-
-
Save wolfymaster/17aefe0993000f140531109fa17ee32a to your computer and use it in GitHub Desktop.
Springboard-Postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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