如何在Azure Web App中为容器安装Docker卷? [英] How to mount docker volume in Azure Web App for containers?

查看:139
本文介绍了如何在Azure Web App中为容器安装Docker卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Azure App Service中运行KrakenD图像.

KrakenD需要将json配置文件krakend.json放入/etc/krakend/(( KrakenD映像基于Linux Alpine )

我为具有以下docker-compose文件的容器创建了Web App:

 版本:"3"服务:克拉肯德:图片:devopsfaith/krakend:latest数量:-$ {WEBAPP_STORAGE_HOME}/site/krakend:/etc/krakend端口:-"8080:8080"重启:总是 

使用blob容器添加了存储帐户,其中上传了示例kraken.json文件

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

但是好像没有正确安装卷

2019-11-15 12:46:29.368错误-容器创建失败krakend_krakend_0_3032a936 with System.AggregateException,一个或发生了更多错误.(Docker API响应状态code = InternalServerError,响应= {"message":无效的音量规范:':/etc/krakend'}))(Docker API响应状态code = InternalServerError,响应= {"message":无效的音量规范:':/etc/krakend'})InnerException:Docker.DotNet.DockerApiException,Docker API响应状态code = InternalServerError,响应= {"message":无效的音量规范:':/etc/krakend'}

2019-11-15 12:46:29.369错误-多容器设备未启动成功

其他问题

  1. 在存储安装中安装路径是什么意思?-我在其中输入了/krankend

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

    1. What does mean Mount path in Storage mounting? - i put there value /krankend

    2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆