如何在 Azure Web App 中为容器安装 docker 卷? [英] How to mount docker volume in Azure Web App for containers?
问题描述
我正在尝试在 Azure 应用服务中运行 KrakenD 映像.
KrakenD 需要将 json 配置文件 krakend.json 放入/etc/krakend/(KrakenD 镜像基于 Linux Alpine)
我使用以下 docker-compose 文件为容器创建了 Web 应用程序:
版本:3"服务:克拉肯德:图片:devopsfaith/krakend:最新卷:- ${WEBAPP_STORAGE_HOME}/site/krakend:/etc/krakend端口:- 8080:8080"重启:总是
添加了带有 blob 容器的存储帐户,其中上传了示例 kraken.json 文件
在应用程序配置中,我添加了这样的路径映射:
但是看起来卷没有正确安装
<块引用>2019-11-15 12:46:29.368 错误 - 容器创建失败krakend_krakend_0_3032a936 与 System.AggregateException,一或发生了更多错误.(Docker API 响应状态代码=内部服务器错误,响应={消息":无效的卷规范: ':/etc/krakend'"} )(Docker API 响应状态代码=内部服务器错误,响应={消息":无效的卷规范:':/etc/krakend'"}) 内部异常:Docker.DotNet.DockerApiException,Docker API 响应状态代码=内部服务器错误,响应={消息":无效的卷规范:':/etc/krakend'"}
2019-11-15 12:46:29.369 错误 - 多容器单元未启动成功
其他问题
存储挂载中的挂载路径是什么意思?- 我把价值放在那里 /krankend
卷定义以 ${WEBAPP_STORAGE_HOME} 开头
I'm trying to run KrakenD image in Azure App Service.
KrakenD requires json config file krakend.json to be put into /etc/krakend/ (KrakenD image is based on Linux Alpine)
I created Web App for containers with the following docker-compose file:
version: "3" services: krakend: image: devopsfaith/krakend:latest volumes: - ${WEBAPP_STORAGE_HOME}/site/krakend:/etc/krakend ports: - "8080:8080" restart: always
Added storage account with a blob container where uploaded sample kraken.json file
In app configuration i added a path mapping like this:
But it looks like volume was not mounted correctly
2019-11-15 12:46:29.368 ERROR - Container create failed for krakend_krakend_0_3032a936 with System.AggregateException, One or more errors occurred. (Docker API responded with status code=InternalServerError, response={"message":"invalid volume specification: ':/etc/krakend'"} ) (Docker API responded with status code=InternalServerError, response={"message":"invalid volume specification: ':/etc/krakend'"} ) InnerException: Docker.DotNet.DockerApiException, Docker API responded with status code=InternalServerError, response={"message":"invalid volume specification: ':/etc/krakend'"}
2019-11-15 12:46:29.369 ERROR - multi-container unit was not started successfully
Additional questions
What does mean Mount path in Storage mounting? - i put there value /krankend
volume definition starts with ${WEBAPP_STORAGE_HOME} in docs they specified it as
volumes: - ${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html
so i did it by analogy and tried all 3 possible paths
${WEBAPP_STORAGE_HOME}/site/wwwroot/krakend ${WEBAPP_STORAGE_HOME}/site/krakend ${WEBAPP_STORAGE_HOME}/krakend
but no luck - still getting the error
ERROR parsing the configuration file: '/etc/krakend/krakend.json' (open): no such file or directory
解决方案finally resolved that with the following docker-compose file
version: "3" services: krakend: image: devopsfaith/krakend:latest volumes: - volume1:/etc/krakend environment: WEBSITES_ENABLE_APP_SERVICE_STORAGE: TRUE ports: - "8080:8080" restart: always
where volume1 is a blob storage mounted as the following
这篇关于如何在 Azure Web App 中为容器安装 docker 卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!