Azure Web App for Container 尝试装载 Blob 存储时出错



我正在开发部署在 azure 中的 dockrized 应用程序,其中包含应用程序服务"适用于容器的 webApp"我正在尝试将 Blob 存储帐户链接到我的应用 我已创建存储帐户,并将其链接到"路径映射"选项卡中的"我的应用"。

但是我一直收到错误说:
Exception in multi-container config parsing: (Line: 13, Col: 15, Idx: 336) - (Line: 13, Col: 37, Idx: 358): Bind mount must start with ${WEBAPP_STORAGE_HOME}.

我想使用自己的卷, 我不想将其绑定到本地主机存储。

我做错了什么?下面是撰写文件的配置和错误, 我什至删除了所有其他服务,以确保没有意外问题

version: '2'
services:     
app:
container_name: almaz-backend
image: 'almazyregistry.azurecr.io/test/alamzo:latest'
restart: always
build: .
ports:
- '3000:3000'        
environment:
- NODE_ENV=production        
volumes:               
- AppDataMount/logs:/logs    
- AppDataMount/public:/public
volumes:
AppDataMount:   
2019-12-01 19:42:52.559 ERROR - Exception in multi-container config parsing: (Line: 13, Col: 15, Idx: 336) - (Line: 13, Col: 37, Idx: 358): Bind mount must start with ${WEBAPP_STORAGE_HOME}.

实际上,设置为装载卷的内容不符合适用于容器的 Azure Web 应用中的规则。如果你想使用 docker-compose 文件,它应该是这样的:

version: '3'
services:     
app:
container_name: almaz-backend
image: 'almazyregistry.azurecr.io/test/alamzo:latest'
restart: always
build: .
ports:
- '3000:3000'        
environment:
- NODE_ENV=production        
volumes:               
- <custom-id1>:/logs/
- <custom-id2>:/public/

每个卷都需要一个容器。所以对你来说,它需要两个容器。您可以使用 CLI 命令设置自定义 ID,如下所示:

az webapp config storage-account add --resource-group <group_name> --name <app_name> --custom-id <custom_id> --storage-type AzureBlob --share-name <share_name> --account-name <storage_account_name> --access-key "<access_key>" --mount-path <mount_path_directory>

有关更多详细信息,请参阅在 Linux 上的应用服务中提供 Azure 存储中的内容。

最新更新