Skip to content

About

dockerized dbt setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

dbt + Postgres (Docker)

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.


Overview

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 deps is 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.


Project Structure

.
├── Dockerfile
├── docker-compose.yml
├── Makefile
├── dbt_project.yml
├── profiles.yml
├── models/
│   └── example_model.sql
├── macros/
│   └── generate_schema_name.sql
└── seeds/

Pre-requisites

You need:

  • Docker
  • Docker Compose
  • Make

Quick Start

1. Start the environment

make dbt-up

This will:

  • Build the images
  • Start Postgres
  • Start the dbt container
  • Install dbt dependencies (dbt deps)
  • Open an interactive shell inside the dbt container

2. Verify dbt connectivity

Inside the dbt container shell, first just run:

dbt debug

If that succeeds, you can then run:

dbt run
dbt test

when you’re ready.


Commands

Use make targets to manage the environment.

  • Initial setup / first run:
make dbt-up
  • List all available commands:
make help

(Optional) Test Postgres Connection Directly

  • All connection and dbt settings are configured via the .env file.
  • You can connect to Postgres from your host using any SQL client:
Host: localhost
Port: 5433
User: myuser
Password: mysecret
Database: mydb

About

dockerized dbt setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages