Skip to content

Instantly share code, notes, and snippets.

@danilogila
Created June 20, 2020 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danilogila/c0e152a2fd119cd7397e2b78082e1a78 to your computer and use it in GitHub Desktop.
Save danilogila/c0e152a2fd119cd7397e2b78082e1a78 to your computer and use it in GitHub Desktop.
Create a Postgres container with a init script. You can create your initial database tables with a init.sql file in ./data/postgres/init.sql in your project.
version: "3"
services:
database:
image: postgres:9.6
container_name: "postgres-db"
environment:
- POSTGRES_DB=db_name
- POSTGRES_USER=db_user
- POSTGRES_PASSWORD=db_password
- POSTGRES_HOST_AUTH_METHOD=trust
- TZ=GMT
volumes:
- ./data/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- 5432:5432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment