Skip to content

Instantly share code, notes, and snippets.

@tbjgolden
Last active May 24, 2021 15:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Figure I'll need this again
version: "3.8"
services:
db:
image: "postgres:12"
ports:
- "54320:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=usrnm
- POSTGRES_PASSWORD=passwd
- POSTGRES_DB=demo
# change vars
# rebuild with:
# docker-compose up --build --force-recreate -d
# enter container:
# docker-compose run db bash
# enter postgres interpreter:
# psql --username=usrnm --dbname=demo --host=db
# add .env file
# DATABASE_URL="postgresql://usrnm:passwd@localhost:54320/demo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment