【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

相关文章
|
5月前
|
网络协议 NoSQL Redis
Docker Compose--模板文件
Docker Compose--模板文件
339 29
|
7月前
|
安全 API 算法框架/工具
大模型文件Docker镜像化部署技术详解
大模型文件Docker镜像化部署技术详解
914 2
|
8月前
|
运维 应用服务中间件 nginx
docker运维查看指定应用log文件位置和名称
通过本文的方法,您可以更高效地管理和查看Docker容器中的日志文件,确保应用运行状态可控和可监测。
844 28
|
7月前
|
Linux 网络安全 虚拟化
linux怎么把文件传到docker里面
在现代应用开发中,Docker作为流行的虚拟化工具,广泛应用于微服务架构。文件传输到Docker容器是常见需求。常用方法包括:1) `docker cp`命令直接复制文件;2) 使用`-v`选项挂载宿主机目录,实现数据持久化和实时同步;3) 通过SCP/FTP协议传输文件;4) 在Dockerfile中构建镜像时添加文件。选择合适的方法并确保网络安全是关键。
621 1
|
12月前
|
Java Docker 索引
Springboot的Container Images,docker加springboot
本文介绍了如何使用Spring Boot的层索引文件和Docker优化Spring Boot应用程序的容器化过程,包括解压缩可执行jar和创建分层Docker映像的方法。
118 9
Springboot的Container Images,docker加springboot
|
12月前
|
存储 Linux Docker
使用Docker存储驱动
【10月更文挑战第9天】
240 3
|
12月前
|
存储 Kubernetes Docker
|
12月前
|
前端开发 Docker 容器
主机host服务器和Docker容器之间的文件互传方法汇总
Docker 成为前端工具,可实现跨设备兼容。本文介绍主机与 Docker 容器/镜像间文件传输的三种方法:1. 构建镜像时使用 `COPY` 或 `ADD` 指令;2. 启动容器时使用 `-v` 挂载卷;3. 运行时使用 `docker cp` 命令。每种方法适用于不同场景,如静态文件打包、开发时文件同步及临时文件传输。注意权限问题、容器停止后的文件传输及性能影响。
2869 1
|
Docker Python 容器
python检测docker compose文件是否正确
python检测docker compose文件是否正确
|
11月前
|
Kubernetes Docker 容器
【赵渝强老师】Docker的Container网络模式
Docker容器在网络环境中彼此隔离,但可通过配置不同网络模式实现容器间通信。其中,container模式使容器共享同一网络命名空间,通过localhost或127.0.0.1互相访问,提高传输效率。本文介绍了container模式的特点及具体示例。
222 0