我正在尝试在 Azure 应用服务中运行 KrakenD 镜像。
KrakenD 需要将 json 配置文件 krakend.json 放入/etc/krakend/(KrakenD 镜像基于 Linux Alpine)
我使用以下 docker-compose 文件为容器创建了 Web 应用程序:
version: "3"
services:
krakend:
image: devopsfaith/krakend:latest
volumes:
- ${WEBAPP_STORAGE_HOME}/site/krakend:/etc/krakend
ports:
- "8080:8080"
restart: always
添加了带有 Blob 容器的存储帐户,其中上传了示例 kraken.json 文件
在应用程序配置中,我添加了如下路径映射:
但看起来卷未正确安装
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
其他问题
存储挂载中的挂载路径是什么意思? - 我把值放在那里/krankend
卷定义以 ${WEBAPP_STORAGE_HOME} in docs 开头他们将其指定为
卷: - ${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html
所以我以此类推,尝试了所有 3 种可能的路径
${WEBAPP_STORAGE_HOME}/site/wwwroot/krakend
${WEBAPP_STORAGE_HOME}/site/krakend
${WEBAPP_STORAGE_HOME}/krakend
但运气不好 - 仍然收到错误
ERROR parsing the configuration file: '/etc/krakend/krakend.json' (open): no such file or directory
最佳答案
最终使用以下 docker-compose 文件解决了这个问题
version: "3"
services:
krakend:
image: devopsfaith/krakend:latest
volumes:
- volume1:/etc/krakend
environment:
WEBSITES_ENABLE_APP_SERVICE_STORAGE: TRUE
ports:
- "8080:8080"
restart: always
其中,volume1 是按以下方式安装的 Blob 存储
关于azure - 如何在Azure Web App中为容器挂载docker卷?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58878134/