windows - 拒绝容器访问 gcloud 凭据
问题描述
我正在尝试在 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.
我把错误放在什么地方?
谢谢,
解决方案
容器与系统的其余部分隔离运行,这是它的优势所在,这也是这种打包方法如此受欢迎的原因。
因此,如果您不将环境中的所有配置传递给容器运行时环境,例如 GOOGLE_APPLICATION_CREDENTIALS env var,那么您的环境中的所有配置都是无效的。
我为此写了一篇文章。让我知道它是否有帮助,如果没有,我们将讨论阻塞点!
推荐阅读
- syntax - 将选定的答案从一个案例复制到另一个案例 SPSS
- html - 如何移动右侧表格边距旁边的滚动条
- android - 使用 MediaCodec 和 MediaMuxer 将 PCM 编码为 AAC 时没有音频
- azure-ad-b2c - 在 Azure Ad B2C 中自助密码重置需要进行 2 次电子邮件验证
- java - 无法在索引中查看 ElasticSearch 创建的文档
- swift - HackerEarth 中的 Unlucky 13 挑战
- node.js - 如何修复此错误:找不到模块“moz”Nodejs
- c# - WPF 如何在数据网格中使用行标题更改列的标题样式?
- maas - MAAS 显示机器的许多核心
- apple-appclips - 为什么 App Clip Code 有效载荷大小限制如此之小