I want to access Docker Secrets in my ASP.Net Core project.
I distilled the issue down to a test API project. All it does is read the directories inside /run/
[HttpGet]
public IEnumerable<string> Get()
{
return Directory.GetDirectories("/run");
}
I changed the compose files to 3.1 and added the plumbing for secrets listed here: how do you manage secret values with docker-compose v3.1?
version: '3.1'
services:
secrettest:
image: secrettest
build:
context: ./SecretTest
dockerfile: Dockerfile
secrets: # secrets block only for 'web' service
- my_external_secret
secrets: # top level secrets block
my_external_secret:
external: true
The get action returns ["/run/lock"]. I do not see a /run/secrets directory. I also shelled into the container to verify it does not see the /run/secrets directory.
I am able to see secrets from other containers. Anyone know what I am missing? Is there another strategy I should take other than the 3.1 compose to configure the container in VS 2017?