Can not access Docker secret from inside container - Windows 10

Docker version 18.06.1-ce, build e68fc7a
Windows 10 Pro
Application is an ASP.NET web site

I’ve created 2 secrets and can see them with ‘docket secret ls’. I have startup code in my web app that looks for the secrets from a location id’d by an environment variable. I’ve tried looking in the following locations:

  • /run/secrets/ (figured this would fail as it is for Linux)
  • c:\ProgramData\Docker\secrets\
  • c:\ProgramData\Docker\internal\secrets

This is the code snippet that checks for the secret where p_name is the name of the secret:
if (Directory.Exists(l_secret_location))
{
returnString = File.ReadAllText(l_secret_location + p_name);
}
I’m always getting an empty string.

I’ll be adding more instrumentation diagnostics to the code but wanted to ask the forum this question in case I’m doing something wrong.

BTW, I powershelled into the running container and also can not find those locations.

While I have enabled docker swarm, I’m starting my containers using docker-compose.

Having the same problem myself. What I am gathering is a few things:

  • The default services runs under the ‘ContainerUser’ account

  • Secrets are in the ‘c:\ProgramData\Docker\secrets’ folder which is not accessable to ‘ContainerUser’

Not sure if any can confirm those observations. I am trying to run the site with an elevated account to check but not sure how to do it from the dotnet command.