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

简介: 【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.
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

在 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

相关文章
|
19天前
|
存储 监控 Docker
如何限制docker使用的cpu,内存,存储
如何限制docker使用的cpu,内存,存储
|
19天前
|
Docker 容器
docker 中文件和外部文件映射
docker 中文件和外部文件映射
|
21天前
|
Java Docker Python
启动docker服务需要的三个重要文件
这篇文章介绍了启动Docker服务所需的三个重要文件:Dockerfile、build_image.sh和run.sh。文章提供了Java和Python两个版本的Dockerfile示例,并解释了每个阶段的作用,如基础镜像的选择、构建环境的设置、以及如何通过参数传递环境变量。build_image.sh脚本用于执行Docker镜像的构建、标记和推送过程,而run.sh脚本则用于执行具体的运行命令,包括设置Java参数和执行jar文件。 文章还强调了这些文件应由项目负责人维护,并根据项目需求自行修改启动命令参数。
15 2
|
23天前
|
Docker 容器
【Azure 应用服务】App Service for Container 无法拉取Docker Hub中的镜像替代方案
【Azure 应用服务】App Service for Container 无法拉取Docker Hub中的镜像替代方案
|
23天前
|
Kubernetes Linux Docker
【Azure 应用服务】使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 4000 characters"错误
【Azure 应用服务】使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 4000 characters"错误
|
23天前
|
开发框架 .NET Linux
【Azure 应用服务】 部署到App Service for Linux 服务的Docker 镜像,如何配置监听端口呢?
【Azure 应用服务】 部署到App Service for Linux 服务的Docker 镜像,如何配置监听端口呢?
|
网络协议 关系型数据库 PostgreSQL
|
3天前
|
弹性计算 运维 持续交付
探索Docker容器化技术及其在生产环境中的应用
探索Docker容器化技术及其在生产环境中的应用
21 5
|
14天前
|
NoSQL 关系型数据库 Redis
mall在linux环境下的部署(基于Docker容器),Docker安装mysql、redis、nginx、rabbitmq、elasticsearch、logstash、kibana、mongo
mall在linux环境下的部署(基于Docker容器),docker安装mysql、redis、nginx、rabbitmq、elasticsearch、logstash、kibana、mongodb、minio详细教程,拉取镜像、运行容器
mall在linux环境下的部署(基于Docker容器),Docker安装mysql、redis、nginx、rabbitmq、elasticsearch、logstash、kibana、mongo
|
14天前
|
NoSQL 应用服务中间件 Redis
Docker跨宿主机容器通信-通过网络跨宿主机互联
这篇文章介绍了Docker容器跨宿主机通信的实现方法,包括Docker的四种网络模式(host、none、container、bridge)以及如何通过修改网络配置和添加路由规则来实现不同宿主机上的容器之间的互联。
40 0
Docker跨宿主机容器通信-通过网络跨宿主机互联