【发布时间】:2021-03-23 05:50:47
【问题描述】:
我正在尝试在 Google Cloud 上实现将数据从 HL7 转换为 FHIR (https://github.com/GoogleCloudPlatform/healthcare/tree/master/ehr/hl7/message_converter/java) 的容器。但是,我无法在我的机器上本地构建容器,以便稍后部署到云中。
当我尝试使用 docker 在本地旋转图像时,总是在凭据的身份验证部分发生错误:
docker run --network=host -v ~/.config:/root/.config hl7v2_to_fhir_converter
/healthcare/bin/healthcare --fhirProjectId=<PROJECT_ID> --fhirLocationId=<LOCATION_ID> --
fhirDatasetId=<DATASET_ID> --fhirStoreId=<STORE_ID> --pubsubProjectId=<PUBSUB_PROJECT_ID> --
pubsubSubscription=<PUBSUB_SUBSCRIPTION_ID> --apiAddrPrefix=<API_ADDR_PREFIX>
我使用的是 Windows,并且已经执行了以下命令来创建凭据:
gcloud auth application-default login
执行上述命令后,凭证保存在:
C:\Users\XXXXXX\AppData\Roaming\gcloud\application_default_credentials.json
-v ~ / .config: /root/.config 命令应该让 docker 在运行镜像时搜索凭证,但它没有。出现的错误是:
The Application Default Credentials are not available. They are available if running in Google
Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined
pointing to a file defining the credentials. See
https://developers.google.com/accounts/docs/application-default-credentials for more information.
我在写什么错误?
谢谢,
【问题讨论】:
-
1) 您对
is supposed to enable the docker to search的假设不正确。容器应用程序无法搜索主机环境。 Google ADC 仅检查已知位置,您指定的路径不是其中之一。 2) 不要引用由 CLIgcloud创建的凭证文件。从您的目录中指定服务帐户 JSON 文件,而不是由 CLI 管理的文件。 -
3) 使用容器挂载语法 (-v) 指定服务帐户文件。然后在启动容器时设置环境变量
GOOGLE_APPLICATION_CREDENTIALS(-e) 告诉它凭据所在的位置。 -
感谢您的帮助!!
标签: windows docker google-cloud-platform google-authentication google-cloud-sdk