Azure 容器应用程序作业:访问 Azure 文件失败并出现安装错误(13):权限被拒绝

问题描述 投票:0回答:1

我正在尝试从

Azure Files
将数据写入
Azure Container App Job
共享。

我做了什么:

  1. 我已创建分享

  2. 我已将其添加到我的

    Container App Environment
    选项卡下
    Azure Files
    (使用存储帐户
    key1

  3. 我已将分享添加到我的

    Volumes
    Container App Job

    部分
  4. 我已将音量添加到

    container

然而,当我启动

Container App Job
时,它出错并显示以下消息:

Container 'container' was terminated with exit code '' and reason 'VolumeMountFailure'. One or more errors occurred. (Shell command exited with non-zero status code. StatusCode = 32 | StdOut =  | StdErr = mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
) (Shell command exited with non-zero status code. StatusCode = 32 | StdOut =  | StdErr = mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
)

容器

container
的基础镜像是
python:3.12-alpine3.19
(内核 6.6)。任何人都可以看到我做错了什么还是这根本不支持?

The share in Azure Files

Container App Environment

Container App Job

Container

azure-files azure-container-apps
1个回答
0
投票

要在容器应用程序作业中使用 Azure 文件共享作为卷,需要将其添加到您已经完成的容器环境中。

当您在

Volume Mounts
部分将文件共享添加为容器应用程序作业中的卷时,您需要从容器环境中可用的列表中选择卷名称。

在装载路径中,您需要提及用于保存数据的

path
,或者根据您的图像所需的路径。

在我的情况下路径是

/mnt/azurefileshare

下面给出了对我有用的简单代码。

entrypoint.sh
:

#!/bin/bash

OUTPUT_FILE="/mnt/azurefileshare/output.txt"

echo "Hello from Azure Container App!" > $OUTPUT_FILE

cat $OUTPUT_FILE

Dockerfile
:

FROM python:3.9-slim

WORKDIR /app

COPY . /app

COPY entrypoint.sh /usr/local/bin/entrypoint.sh

RUN chmod +x /usr/local/bin/entrypoint.sh

CMD ["entrypoint.sh"]

OUTPUT

© www.soinside.com 2019 - 2024. All rights reserved.