【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

  1. In the Azure portal, navigate to the app.

  2. From the left navigation, click Configuration > Path Mappings > New Azure Storage Mount.

  3. Configure the storage mount according to the following table. When finished, click OK.

    SettingDescription
    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

在 Azure 容器实例中装载 Azure 文件共享:https://docs.microsoft.com/zh-cn/azure/container-instances/container-instances-volume-azure-files

Mount storage to Linux containerhttps://docs.microsoft.com/en-us/azure/app-service/configure-connect-to-azure-storage?pivots=container-linux&tabs=portal#mount-storage-to-linux-container

posted @   路边两盏灯  阅读(123)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示