How to fix "Set DOTNET_USER_SECRETS_FALLBACK_DIR" error when using docker compose?

Viewed 1008

I am using docker-compose to run my asp.net api application. When I use the command "docker-compose up" I receive the error:

Could not determine an appropriate location for storing user secrets. Set the DOTNET_USER_SECRETS_FALLBACK_DIR environment variable to a folder where user secrets should be stored.

In my yml file I have:

version: '3'

services:
  kestrel_apache:
    build: ./
    ports:
      - '80:80'
    volumes:
       - ./app:/root/app
       - ./dev.conf:/etc/apache2/sites-available/dev.conf
       - ./entrypoint.sh:/entrypoint.sh
    entrypoint: ./entrypoint.sh
    environment:
        APACHE_RUN_DIR: /var/run/apache2
        DOTNET_CLI_HOME: /tmp
        DOTNET_USER_SECRETS_FALLBACK_DIR: ./secretTest

You can see at the bottom I have added the environment variable and defined it like the error has described. I made sure the folder exists. However, I still get this error. What am I doing wrong?

0 Answers
Related