容器运行后在Azure容器实例中运行命令

时间:2020-04-29 12:34:59

标签: azure containers dock azure-container-instances

我正在运行代码服务器容器,而我正在运行az container exec --resource-group resourcename --name code-server --exec-command "ls",它给出了文件和文件夹列表,但是如果我们运行az container exec --resource-group resourcename --name code-server --exec-command "cd folder"不能正常工作,则会显示类似rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"cd Angular\": executable file not found in $PATH"

1 个答案:

答案 0 :(得分:1)

当您要在容器实例内执行命令时,这是一个常见问题。此功能并非绝对支持Azure容器实例。它仅支持单个命令,并显示here

Azure容器实例当前支持启动单个 使用z容器exec进行处理,您将无法传递命令参数。 例如,您不能像sh -c“ echo FOO && echo BAR”,或执行echo FOO。