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
So, according to Docker documentation:
Therefore you either need to provide
--publish
or-p
when callingdocker compose run
(even if the ports are already defined in your docker compose file) or pass the--service-ports
flag.You probably needs to expose the port
8080
(the default port thatdbt docs serve
serves on, you can change it with--ports
) from Docker by replacing thenetwork_mode: host
with aports:
list in your docker-compose.yml