skip to Main Content

After reading Dbt documentation, I’ve had a hard time to figure out how to install dbt-core (or any other packages i.e. dbt-postgres, dbt-snowflake, etc) on Windows 10.

I have Docker Desktop installed, running a couple of containers already (mostly nodeJS containers, and Kafka). However, it was hard to understand how I would have those new Dbt containers available in my Docker Desktop Console.

I can see docker images were installed properly

$docker image ls
REPOSITORY                      TAG          IMAGE ID       CREATED        SIZE
**ghcr.io/dbt-labs/dbt-core       1.2.1        802a0d70aedc   4 weeks ago    538MB**
**ghcr.io/dbt-labs/dbt-bigquery   1.2.latest   b7502bcd3b35   2 months ago   559MB**
...
postgres                        latest       f8dd270e5152   7 weeks ago    376MB
dpage/pgadmin4                  latest       d13c9d7d0193   2 months ago   382MB
wurstmeister/kafka              latest       a692873757c0   4 months ago   468MB
wurstmeister/zookeeper          latest       3f43f72cb283   3 years ago    510MB

Does anyone know how to I them to the Desktop Console?

2

Answers


  1. Chosen as BEST ANSWER

    I finally was able to pull the image. To add a container in the Docker desktop, I just needed to actually run it.

    However, running a dbt-core container in docker, it returns an error: right after I start the container it stops and returns exit(1), as per the screenshot.

    enter image description here


  2. I’m currently on Windows 10 and use a Docker image for my dbt project without needing WSL. Below is my Dockerfile and requirements.txt file with dbt-core and dbt-snowflake but feel free to swap the packages you need.

    In my repo, my dbt project is in a folder at the root level named dbt.

    requirements.txt

    dbt-core==1.1.0
    dbt-snowflake==1.1.0
    

    Dockerfile

    FROM public.ecr.aws/docker/library/python:3.8-slim-buster
    
    COPY . /dbt
    
    # Update and install system packages
    RUN apt-get update -y && 
      apt-get install --no-install-recommends -y -q 
      git libpq-dev python-dev && 
      apt-get clean && 
      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    
    # Install dbt
    RUN pip install -U pip
    RUN pip install -r dbt/requirements.txt
    # TEMP FIX due to dependency updates. See https://github.com/dbt-labs/dbt-core/issues/4745
    RUN pip install --force-reinstall MarkupSafe==2.0.1
    
    # Install dbt dependencies
    WORKDIR /dbt
    RUN dbt deps
    
    # Specify profiles directory
    ENV DBT_PROFILES_DIR=.dbt
    
    # Expose port for dbt docs
    EXPOSE 8080
    

    And then you can build and run it (I personally put both of these commands in a dbt_run.sh file and run with bash dbt_run.sh):

    docker build -t dbt_image .
    docker run 
    -p 8080:8080 
    --env-file .env 
    -it 
    --mount type=bind,source="$(pwd)",target=/dbt 
    dbt_image bash
    

    If you make changes to your dbt project while the container is running they will be reflected in the container which makes it great for developing locally. Hope this helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search