简体   繁体   English

无法将卷连接到 Azure 容器实例

[英]Can't connect volume to Azure Container Instance

I tried to deploy my Rasa chatbot in an Azure Container Instance using a YAML file and Azure CLI.我尝试使用 YAML 文件和 Azure CLI 在 Azure 容器实例中部署我的 Rasa 聊天机器人。 Although it runs smoothly locally using the local wsl2 volume path /var/lib/docker/volumes/, when in cloud it appears to have the following problem.虽然它使用本地 wsl2 卷路径 /var/lib/docker/volumes/ 在本地运行顺利,但在云中它似乎有以下问题。

Inside the rasa/rasa:3.xx image there is a dockerfile layer that creates a Volume /tmp that contains metadata and python autographs.在 rasa/rasa:3.xx 映像中有一个 dockerfile 层,它创建一个包含元数据和 python 签名的卷 /tmp。 But when I upload the image to the cloud, while it seems that there is a connection with Azure File Share, this /tmp folder is NOT created.但是当我将图像上传到云时,虽然似乎与 Azure 文件共享有连接,但未创建此 /tmp 文件夹。 As you can see in the images below, inside the properties of the ACI, the File Share volume appears to function well.如下图所示,在 ACI 的属性中,文件共享卷似乎运行良好。

ACI with Azure File Share connection ACI 与 Azure 文件共享连接

Empty Azure File Share directory清空 Azure 文件共享目录

Docker VOLUME [/tmp] layer Docker 卷 [/tmp] 层

Below is my deploy-aci.yml used for the: az container create --resource-group --file deploy-aci.yml下面是我的 deploy-aci.yml 用于: az container create --resource-group --file deploy-aci.yml

apiVersion: '2019-12-01'
location: northeurope
name: rasa-core-server
properties:
  containers:
  - name: rasa-core-server
    properties:
      environmentVariables: []
      image: rasaregistry.azurecr.io/rasa-core-server:1.0.0   
      ports:
      - port: 5005
      resources:
        requests:
          cpu: 2
          memoryInGB: 8
          gpu:
            count: 1
            sku: K80          
      volumeMounts:
      - mountPath: /rastorage
        name: rasa-storage
  osType: Linux
  restartPolicy: Always
  ipAddress:
    type: Public
    ports:
    - port: 5005
    dnsNameLabel: rasa-core-server
  imageRegistryCredentials:
  - server: rasaregistry.azurecr.io
    username: test123
    password: test456 
  volumes:
  - name: rasa-storage
    azureFile:
      sharename: rasa-storage
      storageAccountName: test123
      storageAccountKey: test456
tags: {}
type: Microsoft.ContainerInstance/containerGroups

Is there something i am missing about mounting a File Share volume to a Linux Azure Container Instance?关于将文件共享卷安装到 Linux Azure 容器实例,我有什么遗漏吗?

I have already read the documentation about mounting with Azure File Share https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files我已经阅读了有关使用 Azure 文件共享安装的文档https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files

Any help is appreciated!任何帮助表示赞赏!

But when I upload the image to the cloud, while it seems that there is a connection with Azure File Share, this /tmp folder is NOT created.但是,当我将图像上传到云时,虽然似乎与 Azure 文件共享有连接,但未创建此 /tmp 文件夹。

the /tmp folder is mapped with your host even you are taking image of that running container you won't able save that /tmp folder as image and can't able to see in the Azure Container Instance. /tmp文件夹与您的主机映射,即使您正在拍摄该正在运行的容器的图像,您也无法将该/tmp文件夹保存为图像并且无法在 Azure 容器实例中看到。

Only Partition or folder which you have created for local container can able to see in Azure Container Instance because they are not mapped/attached with your host.只有您为本地容器​​创建的分区或文件夹才能在 Azure 容器实例中看到,因为它们没有映射/附加到您的主机。

Another more important things be notice apart from above suggestion除了上述建议之外,另一个更重要的事情是注意

If you mount a share into a container directory in which files or directories exist, the mount obscures files or directories, making them inaccessible while the container runs.如果将共享挂载到存在文件或目录的容器目录中,则挂载会遮盖文件或目录,使它们在容器运行时无法访问。

But when I upload the image to the cloud, while it seems that there is a connection with Azure File Share, this /tmp folder is NOT created.但是当我将图像上传到云时,虽然似乎与 Azure 文件共享有连接,但未创建此 /tmp 文件夹。

the /tmp folder is mapped with your host even you are taking image of that running container you won't able save that /tmp folder as image and can't able to see in the Azure Container Instance. /tmp文件夹与您的主机映射,即使您正在拍摄该正在运行的容器的图像,您也无法将该/tmp文件夹保存为图像并且无法在 Azure 容器实例中看到。

Only Partition or folder which you have created for local container can able to see in Azure Container Instance because they are not mapped/attached with your host.只有您为本地容器​​创建的分区或文件夹才能在 Azure 容器实例中看到,因为它们没有映射/附加到您的主机。

Another more important things be notice apart from above suggestion : Below Suggestion is taken from Mount an Azure file share in Azure Container Instances除了上述建议之外,还要注意另一个更重要的事情:以下建议取自Mount an Azure file share in Azure Container Instances

If you mount a share into a container directory in which files or directories exist, the mount obscures files or directories, making them inaccessible while the container runs.如果将共享挂载到存在文件或目录的容器目录中,则挂载会遮盖文件或目录,使它们在容器运行时无法访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM