az acr运行:错误:无法识别的参数:--cmd

迈克·威廉姆斯

我正在按照此页面上的说明在Azure容器注册表中创建Docker映像。一切正常,直到进入“运行图像”步骤。当我运行命令时:

az acr run --registry {the name of my registry} --cmd '{the name of my registry}.azurecr.io/sample/hello-world:v1" /dev/null

我收到以下错误:

az acr run: error: unrecognized argument: --cmd {the name of my registry}.azurecr.io/sample/hello-world:v1
usage: az acr run [-h] [--verbose] [--debug]
                  [--output {json,jsonc,table,tsv,yaml,none}]
                  [--query JMESPATH] --registry REGISTRY_NAME [--file FILE]
                  [--values VALUES] [--set SET_VALUE]
                  [--set-secret SET_SECRET] [--no-format] [--no-logs]
                  [--timeout TIMEOUT] [--resource-group RESOURCE_GROUP_NAME]
                  [--os OS_TYPE] [--platform PLATFORM]
                  [--auth-mode {None,Default}] [--no-wait]
                  [--subscription _SUBSCRIPTION]
                  <SOURCE_LOCATION>

似乎az acr run命令不支持文档中指定的--cmd参数。

当我运行az --version时,得到以下信息:

azure-cli                         2.0.61 *
acr                                2.2.3 *

我究竟做错了什么?文档是否正确?我应该使用其他版本的Azure CLI吗?

迈克·威廉姆斯

问题是我在计算机的Ubuntu WSL安装中正在运行旧版本的Azure CLI。当我从安装了Azure CLI 2.9.1版本的Azure Cloud Shell中尝试命令时,该命令成功。此外,如果我获得了该命令的帮助,则会得到以下内容,其中包括--cmd参数。

usage: az acr run [-h] [--verbose] [--debug] [--only-show-errors]
                  [--output {json,jsonc,yaml,yamlc,table,tsv,none}]
                  [--query JMESPATH] [--subscription _SUBSCRIPTION] --registry
                  REGISTRY_NAME [--agent-pool AGENT_POOL_NAME] [--file FILE]
                  [--values VALUES] [--set SET_VALUE]
                  [--set-secret SET_SECRET] [--cmd CMD_VALUE] [--no-format]
                  [--no-logs] [--timeout TIMEOUT]
                  [--resource-group RESOURCE_GROUP_NAME] [--platform PLATFORM]
                  [--auth-mode {None,Default}] [--no-wait]
                  <SOURCE_LOCATION>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章