适用于容器和AppSettings /环境变量的Azure WebApp

时间:2018-11-28 23:47:00

标签: azure containers azure-web-app-for-containers

我有一个用于运行linux的容器的Web应用程序。我正在运行一个Docker容器。都可以,但是我想添加一个环境变量,如下所示:

docker run -e my_app_setting_var=theValue

文档说,应用程序设置将在此处自动添加为-e环境变量: App Settings are injected into your app as environment variables at runtime

但是,正如您从我的日志中看到的那样,它没有添加:(一些东西被剥离了)

docker run -d -p 30174:5000 --name thename -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=5000 -e WEBSITE_SITE_NAME=the_website_name -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=the_role_id -e HTTP_LOGGING_ENABLED=1 acr_where_image_is.azurecr.io/image_name:latest Dockerfile

我希望看到这样的环境变量:

docker run -d -p 30174:5000 --name thename -e my_app_setting_var=theValue

有什么想法吗?

欢呼

1 个答案:

答案 0 :(得分:1)

Azure Web App for Container将注入您在门户中或通过Azure CLI设置的环境变量。但是不幸的是,您不会在日志中看到环境变量。日志将显示一些变量。您只需回显一下Kudu之类的工具中的变量,就可以在环境中看到它们。

enter image description here enter image description here enter image description here