gpt4 book ai didi

azure - 尝试创建 docker 容器功能应用程序,当我执行 docker run 时出现错误 "Storage not defined"

转载 作者:行者123 更新时间:2023-12-02 20:55:47 24 4
gpt4 key购买 nike

遵循 Microsoft 文档 ( https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image?tabs=bash%2Cportal&pivots=programming-language-python ),但适用于 Azure Blob 存储触发器模板。

当我运行 docker run -p 8080:80 -it example/azurefunctionsimage:v1.0 时出现以下错误,

 fail: Host.Startup[402]
fail: Host.Startup[402]
The 'voice-text' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.voice-text'. Microsoft.Azure.WebJobs.Extensions.Storage: Storage account connection string 'AzureWebJobsStorage' does not exist. Make sure that it is a defined App Setting.
Hosting environment: Production
Content root path: /
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
info: Host.General[316]
Host lock lease acquired by instance ID '0000000000000000000000000'.
warn: Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService[0]
Breaking change analysis operation failed
System.InvalidOperationException: The BlobChangeAnalysisStateProvider requires the default storage account 'Storage', which is not defined.
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.BlobChangeAnalysisStateProvider.GetCurrentAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/BlobChangeAnalysisStateProvider.cs:line 40
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.TryLogBreakingChangeReportAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 92

请帮忙解决这个错误..

最佳答案

Azure Functions 需要存储帐户才能在本地运行。

添加此内容的最佳方法是在 Azure 中创建一个存储帐户,并将连接字符串作为名为 AzureWebJobsStorage 的环境变量传递给 docker run 命令。

docker run -p 8080:80 -it -e AzureWebJobsStorage="{connection-string}" <docker-id>/mydockerimage:v1.0.0

关于azure - 尝试创建 docker 容器功能应用程序,当我执行 docker run 时出现错误 "Storage not defined",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63113911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com