无法将环境变量添加到现有容器

Unable to add environment variables to existing container

使用 Azure CLI,我尝试使用以下命令将环境变量添加到现有的 azure 容器:

$ az container create --resource-group toms-cool-group --name my-cool-container --image my-cool-container:v1 --environment-variables 'NumWords'='5' 'MinLength'='8'

但我收到以下错误:

The updates on container group 'receipt-validator' are invalid. If you are going to update the os type, restart policy, network profile, CPU, memory or GPU resources for a container group, you must delete it first and then create a new one.

有什么想法吗?

为什么不呢,您可以使用您展示的命令将环境变量添加到现有的 azure 容器中:

az container create --resource-group toms-cool-group --name my-cool-container --image my-cool-container:v1 --environment-variables 'NumWords'='5' 'MinLength'='8'

如我所见,错误显示组 'receipt-validator' 与命令 toms-cool-group 中的组不同。也许这是你犯的错误。另外,在添加环境变量的时候,区别只是命令中要添加的环境变量不同,其他都是一样的。

我这边的测试:

顺便说一句,实际上,更新只是对 azure 容器的重新部署。不同之处在于,重新部署是它的容器镜像层是从之前部署缓存的容器镜像层中提取的。