Created
February 15, 2026 23:54
-
-
Save sueszli/4165d5e388cf289978ea64fdcda7661b to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| set -euox pipefail | |
| CONTAINER=pg | |
| docker rm -f $CONTAINER 2>/dev/null || true | |
| docker run -d --name $CONTAINER --rm -e POSTGRES_PASSWORD=pass postgres:17-alpine >/dev/null | |
| until docker exec $CONTAINER pg_isready >/dev/null 2>&1; do :; done; sleep 1 | |
| # run stuff | |
| docker exec $CONTAINER psql -U postgres -c "CREATE TABLE fruits (fruit TEXT);" | |
| docker exec $CONTAINER psql -U postgres -c "INSERT INTO fruits VALUES ('apple'), ('orange'); SELECT * FROM fruits;" | |
| docker exec $CONTAINER psql -U postgres -c "SELECT * FROM fruits;" | |
| docker stop $CONTAINER >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment