I'm quite new to Docker and .Net Core (been using .Net Framework for ages).
I've created a new .Net Core 3 app and set it to use Docker and the app builds and runs. So far so good. This app needs to connect to GoogleBigQuery and, as such, needs the Google Cloud credentials to be stored in an environment variable (took a frustrating hour to realise that Docker doesn't use the Windows environment variables).
From what I've been reading, I would just add them to the .env file, but I don't have one in my project directory.
I've tried using the command line to set them like this docker run containername:dev --env VAR1=value1 but I get the following error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "-e": executable file not found in $PATH: unknown.
I've also seen references to the docker-compose.yml file.
I've tried creating the .env file and tried (unsuccessfully) using the CLI to associate it with the container as follows:
docker run -i containername:dev --env-file .env
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "--env-file": executable file not found in $PATH: unknown.
So I'm not sure where to go from here. Everything I've read seems to assume that you already have a .env and I can't find anything around creating a .env manually. I did create a docker-compose.yml file which I was hoping Docker would recognise and subsequently find the .env:
version: '3.5'
services:
fms-techmobile-utilities:
build:
context: .
dockerfile: Local.Dockerfile
image: foo
container_name: foo
restart: unless-stopped
env_file:
- .env
The above didn't work, so I really don't know what else to try. I did try stopping and restarting the Docker container in the hopes that it would find the yml and env files, but nope
