skip to Main Content

I’ve try to use dbt on docker with the configuration from official docker and with my docker-compose.yaml and profiles.yml below. The code is from this course.

After, docker compose build and dbt project init every others command (e.g., dbt debug, dbt run, dbt docs generate) is working fine. But dbt docs serve is logging as served but not accessible.

I’ve try to delete network_mode: host line from docker-compose.yaml as suggested from the course FAQ. However, the docs serve still not served.

  • docker-compose.yaml
version: '3'
  services:
    <projectName>:
      build:
        context: .
        target: dbt-bigquery
      image: dbt/bigquery
      volumes:
        - .:/usr/app
        - ~/.dbt/:/root/.dbt/
        - <path to gg cred key>
      network_mode: host
  • profiles.yml
bq-dbt-workshop:
  outputs:
    dev:
      dataset: <bigquery-dataset>
      fixed_retries: 1
      keyfile: <path to gg cred key>
      location: asia-southeast1
      method: service-account
      priority: interactive
      project: <gcp-project-id>
      threads: 4
      timeout_seconds: 300
      type: bigquery
  target: dev
  • dbt docs serve log
14:36:04  Running with dbt=1.0.8
14:36:04  Serving docs at 0.0.0.0:8080
14:36:04  To access from your browser, navigate to:  http://localhost:8080
14:36:04
14:36:04
14:36:04  Press Ctrl+C to exit.

Thank you.

2

Answers


  1. So, according to Docker documentation:

    docker-compose run ignores ports unless you include --service-ports.


    Therefore you either need to provide --publish or -p when calling docker compose run (even if the ports are already defined in your docker compose file) or pass the --service-ports flag.

    Login or Signup to reply.
  2. You probably needs to expose the port 8080 (the default port that dbt docs serve serves on, you can change it with --ports) from Docker by replacing the network_mode: host with a ports: list in your docker-compose.yml

    version: '3'
      services:
        <projectName>:
          build:
            context: .
            target: dbt-bigquery
          image: dbt/bigquery
          volumes:
            - .:/usr/app
            - ~/.dbt/:/root/.dbt/
            - <path to gg cred key>
          ports:
            - "8080:8080"
    
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search