Environmental variables and folder locations – Docker & Git Bash

huangapple go评论55阅读模式
英文:

Environmental variables and folder locations - Docker & Git Bash

问题

我尝试在Windows上使用Git Bash运行Docker容器(https://metriql.com/metriql-cli/cli-overview/):

export DBT_PROJECT_DIR=${PWD};
export DBT_PROFILES_DIR=${HOME}/.dbt;
export METRIQL_PORT=5656;

docker run -it -p "${METRIQL_PORT}:5656" -v "${DBT_PROJECT_DIR}:/root/app" -v "${DBT_PROFILES_DIR}:/root/.dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=/root/app buremba/metriql serve 

但是,我收到错误消息:“profiles.yml不存在于/C:/Users/katep/.dbt/profiles.yml中。请设置--profiles-dir选项。”

所以,我更改为:

export DBT_PROJECT_DIR=${PWD};
export DBT_PROFILES_DIR=${HOME}/.dbt;
export METRIQL_PORT=5656;

docker run -p "${METRIQL_PORT}:5656" -v "${DBT_PROJECT_DIR}:/root/app" -v "${DBT_PROFILES_DIR}:/root/.dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=/root/app buremba/metriql serve --project-dir "C:/Users/katep/OneDrive/Documents/redshift/metriql" --profiles-dir "C:/Users/katep/.dbt/"
 --manifest-json file:C:/Users/katep/OneDrive/Documents/redshift/metriql/target/manifest.json

我仍然遇到相同的错误。我猜测我可能错误地分配了环境变量。我做错了什么?

英文:

I am trying to run a docker container (https://metriql.com/metriql-cli/cli-overview/ using Git Bash on Windows:

export DBT_PROJECT_DIR=${PWD};
export DBT_PROFILES_DIR=${HOME}/.dbt;
export METRIQL_PORT=5656;

docker run -it -p "${METRIQL_PORT}:5656" -v "${DBT_PROJECT_DIR}:/root/app" -v "${DBT_PROFILES_DIR}:/root/.dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=/root/app buremba/metriql serve 

However, I was getting the error ' profiles.yml does not exist in /C:/Users/katep/.dbt/profiles.yml. Please set --profiles-dir option.'

So, I changed to:

export DBT_PROJECT_DIR=${PWD};
export DBT_PROFILES_DIR=${HOME}/.dbt;
export METRIQL_PORT=5656;

docker run -p "${METRIQL_PORT}:5656" -v "${DBT_PROJECT_DIR}:/root/app" -v "${DBT_PROFILES_DIR}:/root/.dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=/root/app buremba/metriql serve --project-dir "C:/Users/katep/OneDrive/Documents/redshift/metriql" --profiles-dir "C:/Users/katep/.dbt/"
 --manifest-json file:C:/Users/katep/OneDrive/Documents/redshift/metriql/target/manifest.json

I continue getting the same error. My assumption is that I am assigning environmental variables incorrectly. What am I doing wrong?

答案1

得分: 1

已解决。正确的命令是:

docker run -it -p "${METRIQL_PORT}:5656" -v "/${DBT_PROJECT_DIR}://root/app" -v "/${DBT_PROFILES_DIR}://root/dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=//root/app buremba/metriql serve
英文:

Resolved. The correct command is:

docker run -it -p "${METRIQL_PORT}:5656" -v "/${DBT_PROJECT_DIR}://root/app" -v "/${DBT_PROFILES_DIR}://root/dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=//root/app buremba/metriql serve

huangapple
  • 本文由 发表于 2023年3月12日 09:00:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75710502.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定