Q:

Error The 'ClientId' option must be provided. When building a docker image

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.

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.  
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.

A:

To Add Google+ Authentication you can see this guide.
Add this snippet in startup.cs
services.AddAuthentication().AddGoogle(googleOptions =>
{
    googleOptions.ClientId = Configuration["Authentication:Google:ClientId"];
    googleOptions.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

Add this line in appsettings.json
"Authentication": {
    "Google": {
        "ClientId": "ID FROM GOOGLE API",
        "ClientSecret": "SECRET FROM GOOGLE API"
}

A:

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?
And you are right, that you should use Environment Variables for instead, or as alternative, some external settings storage like DB.

