您的位置:首页 > 运维架构 > Docker

【Azure 应用服务】应用服务中发布Docker Container,如何添加卷(如Azure File Share)以便永久存储文件

2022-03-14 19:23 676 查看

问题描述

应用服务中发布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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐