无法在Azure容器应用程序中安装音量
我一直在尝试将Nopcommerce网站的Docker映像构建和部署到新的Azure Container Apps服务。 我在Azure Devops中构建容器到Azure容器注册表,启动容器并将其连接到Azure SQL db,我有一些成功文件共享(以存储共享的AppSettings.json文件和其他容器中的其他config)。 我一直在尝试遵循MS文档在这里,但由于尝试执行app.yaml文件的更新以在我现有的容器中添加存储支架时,已经变得毫无疑问。 步骤1 :(请参阅上面的链接)在容器应用程序环境中注册我的存储空间,并在Azure CLI上返回而没有问题。
步骤2:根据指令,我在Azure CLI上运行下面的命令,以拉下.YAML结构中描述的容器应用程序。
az containerapp show -n <APP_NAME> -g <RESOURCE_GROUP_NAME> -o yaml > app.yaml
步骤3:建议编辑文件以根据我在步骤1中添加的存储(请参阅链接)包含安装说明。我使用Visual Studio代码对此进行了几次操作,以使我的YAML格式在点上(以前没有使用),但是每次我尝试根据下面的命令(步骤4)上传编辑的YAML(步骤4)时,我会在CLI上遇到错误。
az containerapp update --name <APP_NAME> --resource-group <RESOURCE_GROUP_NAME> \
--yaml my-app.yaml
该命令失败,出乎意料的错误。这是追溯:
unacceptable character #x0000: special characters are not allowed
in "app.yaml", position 3
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 718, in _run_job
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp_client_factory.py", line 28, in _polish_bad_errors
raise ex
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 700, in update_containerapp
return update_containerapp_logic(cmd,
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 512, in update_containerapp_logic
return update_containerapp_yaml(cmd=cmd, name=name, resource_group_name=resource_group_name, file_name=yaml, no_wait=no_wait, from_revision=from_revision)
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 124, in update_containerapp_yaml
yaml_containerapp = process_loaded_yaml(load_yaml_file(file_name))
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 100, in load_yaml_file
return yaml.safe_load(stream)
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/init.py", line 125, in safe_load
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/init.py", line 79, in load
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/loader.py", line 34, in init
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 85, in init
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 135, in determine_encoding
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 169, in update
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 143, in check_printable
yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed
in "app.yaml", position 3
作为一种理智测试,我最终没有对app.yaml文件进行任何编辑,而只是尝试使用(按照步骤3)更新(按照步骤2)(按照步骤2)而更新仍然遇到此错误! 我在Windows 10笔记本电脑上进行此操作,然后到达偏执狂的点,我想知道YAML是否足够敏感,可以反对不同的Cr LF线路结尾... 是否有人成功地设法使用这些说明将Azure Fileshare安装在Azure容器应用程序中,如果可以的话,他们可以看到我出错的位置吗?他们还可以共享成功yaml文件的编辑版本,因为我为我创建的文件与该过程的文档显示的格式不匹配,我的.yaml文件具有 - 命令[]部分(请参阅下文)示例YAML片段中未显示。
template:
containers:
- command: []
env:
- name: AZURE_SQL_CONNECTIONSTRING
secretRef: azure-sql-connectionstring-52068
image: myregistry.azurecr.io/nopcommerce:2
name: mynopcommerce-store-container-app
resources:
cpu: 0.25
memory: 0.5Gi
scale:
maxReplicas: 10
I have been trying to build and deploy a Docker image of the nopCommerce website to the new-ish Azure Container Apps service.
I have had some success in building the container in Azure DevOps to an Azure container registry, starting the container and having it connect to an Azure SQL DB I'm having issues with getting the the container to mount a shared volume based on Azure Storage SMB File Share (in order to store a shared appsettings.json file and other config across containers).
I have been trying to follow the MS documentation here but have become unstuck on trying to carry out the update to the app.yaml file to add a storage mount to my existing container.
Step 1: (See link above) registers my storage in the Container App environment and returns without issue on the Azure CLI.
Step 2: As per the instructions I run the command below on the Azure CLI to pull down my container app described in .yaml structure.
az containerapp show -n <APP_NAME> -g <RESOURCE_GROUP_NAME> -o yaml > app.yaml
Step 3: Suggests editing the file to include a mount description based on the storage I added in step 1 (see link). I had several goes at this using Visual Studio Code to keep my yaml formatting on point (not used it before) but every time I tried to upload the edited yaml as per the command below (Step 4) I get an error on the CLI.
az containerapp update --name <APP_NAME> --resource-group <RESOURCE_GROUP_NAME> \
--yaml my-app.yaml
The command failed with an unexpected error. Here is the traceback:
unacceptable character #x0000: special characters are not allowed
in "app.yaml", position 3
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 718, in _run_job
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp_client_factory.py", line 28, in _polish_bad_errors
raise ex
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 700, in update_containerapp
return update_containerapp_logic(cmd,
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 512, in update_containerapp_logic
return update_containerapp_yaml(cmd=cmd, name=name, resource_group_name=resource_group_name, file_name=yaml, no_wait=no_wait, from_revision=from_revision)
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 124, in update_containerapp_yaml
yaml_containerapp = process_loaded_yaml(load_yaml_file(file_name))
File "C:\Users\craig.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 100, in load_yaml_file
return yaml.safe_load(stream)
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/init.py", line 125, in safe_load
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/init.py", line 79, in load
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/loader.py", line 34, in init
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 85, in init
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 135, in determine_encoding
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 169, in update
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\yaml/reader.py", line 143, in check_printable
yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed
in "app.yaml", position 3
As a sanity test I ended up NOT making any edits to the app.yaml file and just trying to update (as per Step 3) with the original file that was created in (as per Step 2) and I am still getting this error!
I am doing this on a Windows 10 laptop and getting to the point of paranoia where I am wondering if yaml is sensitive enough to object to different CR LF line endings...
Has anyone successfully manage to mount an Azure FileShare in Azure Container Apps using these instructions and if so can they see where I am going wrong? Also could they share a redacted version of the successful yaml file as the one that gets created for me does not match the format shown the documentation for the process, my .yaml file has a - command[] part to it (see below) which is not shown in the example yaml snippet.
template:
containers:
- command: []
env:
- name: AZURE_SQL_CONNECTIONSTRING
secretRef: azure-sql-connectionstring-52068
image: myregistry.azurecr.io/nopcommerce:2
name: mynopcommerce-store-container-app
resources:
cpu: 0.25
memory: 0.5Gi
scale:
maxReplicas: 10
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几天前,我刚刚遇到了这个问题。问题最终是该文件位于UTF-16 Le Bom编码中,并且BOM在文件的开头添加了一个不可见的字符,而Azure不喜欢。如果您将其切换为没有BOM的编码(我使用UTF-8),则应该像魅力一样工作。
I just had this issue a few days ago. The issue ended up being that the file is in UTF-16 LE BOM encoding and the BOM adds an invisible character at the beginning of the file that Azure does not like. If you switch it to an encoding without the BOM (I used UTF-8) it should work like a charm.