错误必须提供“ClientId"选项.构建 docker 镜像时 [英] Error The 'ClientId' option must be provided. When building a docker image

查看:33
本文介绍了错误必须提供“ClientId"选项.构建 docker 镜像时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我启动了一个新的 .net 核心项目,并将其配置为使用 Google+ Api 进行身份验证.我的客户端 ID 和机密使用 dotnet 用户机密存储.当我构建我的 docker 镜像时,我得到

I've started a new .net core project and I configured it to use the Google+ Api for authentication. My Client Id and Secret are stored using dotnet user-secrets. When I build my docker image I get

 Unhandled Exception: System.ArgumentException: The 'ClientId' option must be provided.

我知道这是因为我的秘密没有被提供给图像.我想知道的是如何在不将它们提交到存储库的情况下提供我的 Id 和密钥,并且仍然在本地运行我的图像.

I know this is because my secrets aren't being provided to the image. What I want to know is how can I provide my Id and Secret key without committing them to the repository and still run my image locally.

我在想,当我将它部署到服务器时,我可以将它们作为 Env 变量的一部分,我想我也可以在本地执行此操作,只是想知道是否有其他人对此有解决方案可能比我的更优雅.

I was thinking when I deploy it to the server I can have them as part of the Env variables, I guess I could do that locally too, just wondering if anyone else has a solution for this that may be more elegant than mine.

我找不到太多关于其他人如何做这件事的信息.

I just can't find much info on how others are doing this.

推荐答案

首先,secrets 不是你应该用于部署的东西.通过帮助防止敏感数据存储在代码中/签入源代码控制,在开发过程中存在安全存储的秘密.请参阅相关问题 UserSecrets 如何在云端工作?

First of all, secrets is not what you should use for deploying. Secrets exists for safe storage during development by helping prevent sensitive data from being storing in code / checked into source control. See related question How do UserSecrets work in the Cloud?

您是对的,您应该使用环境变量来代替或替代某些外部设置存储,例如 DB.

And you are right, that you should use Environment Variables for instead, or as alternative, some external settings storage like DB.

这篇关于错误必须提供“ClientId"选项.构建 docker 镜像时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆