tpm900
tpm900

Reputation: 271

Azure App Service - How to use environment variables in docker container?

I'm using an Azure App Service to run my docker image. Running my docker container requires using a couple of environment variables. Locally, when I run my container I just do something like:

docker run -e CREDENTIAL -e USERNAME myapp

However, in the Azure App Service, after defining CREDENTIAL and USERNAME as Application Settings, I'm unsure how to pass these to the container. I see from the logs that on startup Azure passes some of its own environment variables, but if I add a startup command with my environment variables, it tacks it on at the end of the one generated by Azure creating an invalid command. How can I pass mine to the container?

Upvotes: 1

Views: 3833

Answers (1)

Kamil Kwiaton
Kamil Kwiaton

Reputation: 167

As I understand you want to set environment variables in that docker container with -e option. You don't need to use startup command for that. Pass these variables as application settings: app settings

Application Settings are exposed as environment variables for access by your application at runtime.

Documentation

Upvotes: 3

Related Questions