我正在尝试从
Azure Files
将数据写入 Azure Container App Job
共享。
我做了什么:
我已创建分享
我已将其添加到我的
Container App Environment
选项卡下Azure Files
(使用存储帐户key1
)
我已将分享添加到我的
Volumes
的
Container App Job
部分
我已将音量添加到
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)。任何人都可以看到我做错了什么还是这根本不支持?
要在容器应用程序作业中使用 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
: