azure - 如何在Azure Web App中为容器挂载docker卷?

标签 azure docker-compose azure-storage krakend

我正在尝试在 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 文件 enter image description here

在应用程序配置中,我添加了如下路径映射:

enter image description here

但看起来卷未正确安装

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

其他问题

  1. 存储挂载中的挂载路径是什么意思? - 我把值放在那里/krankend

  2. 卷定义以 ${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 存储

enter image description here

关于azure - 如何在Azure Web App中为容器挂载docker卷?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58878134/

相关文章:

azure - 使用 fiddler/postman 进行 Azure 表存储 REST API

c# - 提高 Azure Blob 存储查询速度

azure - 在 Hdinsight (Azure) 中可视化 HBase

networking - 使用主机 DNS 服务器的 Docker-compose 容器

docker-compose up 通过 Windows bat 文件?

azure - 将 10,000,000 个文件从 Linux 上传到 Azure Blob 存储

azure - 部署后清理包文件夹

java - 如何使用 Azure DevOps 发布管道将 Java 应用程序部署到 Tomcat 8 App Service?

azure - 如何优化区域部署以最小化感知延迟并最大程度地节省成本?

docker - 将 php docker 链接到托管 mysql