【Azure 应用服务】应用服务中发布Docker Container,如何添加卷(如Azure File Share)以便永久存储文件
问题描述
应用服务中发布Docker Container,如何添加卷(如Azure File Share)以便永久存储文件
问题解答
App Service可以通过门户配置Mount Storage,用于添加卷(Volumes)。 操作办法见:https://docs.microsoft.com/en-us/azure/app-service/configure-connect-to-azure-storage?pivots=container-linux&tabs=portal#mount-storage-to-linux-container
Mount storage to Linux container
-
In the Azure portal, navigate to the app.
-
From the left navigation, click Configuration > Path Mappings > New Azure Storage Mount.
-
Configure the storage mount according to the following table. When finished, click OK.
Setting Description Name Name of the mount configuration. Spaces are not allowed. Configuration options Select Basic if the storage account is not using service endpoints or private endpoints. Otherwise, select Advanced. Storage accounts Azure Storage account. Storage type Select the type based on the storage you want to mount. Azure Blobs only supports read-only access. Storage container or Share name Files share or Blobs container to mount. Access key (Advanced only) Access key for your storage account. Mount path Directory inside the Linux container to mount to Azure Storage. Do not use /
or/home
.
Note
Adding, editing, or deleting a storage mount causes the app to be restarted.
但是,如果使用的Multi-Container部署的App Service,还需要再Compose yaml file文件中指定 Mount的文件夹Path。
version: '3.1'
services:
nginx:
image: nginx:latest
ports:
- 8080:80
volumes:
- storagecustomid:/test/mount
参考资料
使用自定义容器将自定义软件迁移到 Azure 应用服务: https://docs.microsoft.com/zh-cn/azure/app-service/tutorial-custom-container?pivots=container-linux
Mount storage to Linux container:https://docs.microsoft.com/en-us/azure/app-service/configure-connect-to-azure-storage?pivots=container-linux&tabs=portal#mount-storage-to-linux-container
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?