A minimal, generic setup for running dbt Core against a local Postgres database using Docker + docker-compose.
Includes:
- dbt container
- Postgres container
- Makefile helpers
- Example model
- Preconfigured folder structure
Perfect for testing, prototyping, or learning dbt.
This project provides a fully containerized dbt development environment:
- Postgres runs in Docker
- dbt (Postgres adapter) runs in a separate container
- Your project files are mounted into the dbt container
dbt depsis run automatically on startup- An interactive shell opens inside the dbt container
- Includes an example model in
models/example_model.sql
Everything is isolated, reproducible, and easy to run on any machine with Docker installed.
.
├── Dockerfile
├── docker-compose.yml
├── Makefile
├── dbt_project.yml
├── profiles.yml
├── models/
│ └── example_model.sql
├── macros/
│ └── generate_schema_name.sql
└── seeds/
You need:
- Docker
- Docker Compose
- Make
make dbt-upThis will:
- Build the images
- Start Postgres
- Start the dbt container
- Install dbt dependencies (
dbt deps) - Open an interactive shell inside the dbt container
Inside the dbt container shell, first just run:
dbt debugIf that succeeds, you can then run:
dbt run
dbt testwhen you’re ready.
Use make targets to manage the environment.
- Initial setup / first run:
make dbt-up- List all available commands:
make help- All connection and dbt settings are configured via the
.envfile. - You can connect to Postgres from your host using any SQL client:
Host: localhost
Port: 5433
User: myuser
Password: mysecret
Database: mydb