有人可以告诉我我在这里做错了什么,因为我无法创建图像吗?实际上,当我在我的 Centos 主机上运行时,这些命令工作正常,但是当我通过打包器执行相同的命令时,会导致错误。
JSON 文件:
{
"builders": [{
"type": "azure-arm",
"client_id": "{{user `azure-client-id`}}",
"client_secret": "{{user `azure-client-secret`}}",
"tenant_id": "{{user `azure-tenant-id`}}",
"subscription_id": "{{user `azure-subscription-id`}}",
"managed_image_resource_group_name": "{{user `azure-resource-group`}}",
"managed_image_name": "CentOS8-Packer",
"os_type": "Linux",
"image_publisher": "OpenLogic",
"image_offer": "CentOS",
"image_sku": "8_2-gen2",
"location": "{{user `azure-region`}}",
"vm_size": "{{user `vm-size`}}"
}],
"provisioners": [
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"script":"ami-script.sh"
"type": "shell"
}
]
}
ami-script.sh内容:
#!/bin/bash -e
dnf update -y
dnf install terminator xrdp -y
错误:更新部分:
dnf update -y
错误: