I have created an ASP.NET application that connects to microsoft sql database and needs a password for that. When running the application under Windows it takes the password from secrets.json file located in C:Users<user>AppDataRoamingMicrosoftUserSecrets<UserSecretsId>
When running under Docker I am unable to find out where I should put the secrets.json file. I tried /root/.microsoft/usersecrets/ as it seemed to work for others but no for me. Guess I am not among the lucky ones.
Does anyone have an idea?
Advertisement
Answer
Rather than using user secrets I would suggest you pass these values in as environmental variables. While it is possible to store user secrets inside a docker image, you’d be putting your secrets into a repository, which is not something you want to do. Instead, you can pass in the values as environmental variables when the docker run is performed. See Environmental Variable Configuration Provider