Warm tip: This article is reproduced from stackoverflow.com, please click
azure azure-cli azure-container-instances containers docker

Azure ACI container deployment fails when launching with Command line arguments

发布于 2020-04-23 11:04:36

I am trying to launch an ACI container from Azure CLI. The deployment fails when I send multiple commands from command-line and it succeeds when I just pass one command, like 'ls'.

Am I passing multiple arguments to the command line in the wrong way?

az container create --resource-group rg-***-Prod-Whse-Containers --name test--image alpine:3.5 --command-line "apt-get update   &&  apt-get install -y && wget wget https://www.google.com" --restart-policy never --vnet vnet-**-eastus2 --subnet **-ACI
Questioner
Prasoon
Viewed
31
Joey Cai 2020-02-08 22:28

Unfortunately, it seems that you cannot run multi-command in one time. See the Restrictions of the exec command for ACI:

Azure Container Instances currently supports launching a single process with az container exec, and you cannot pass command arguments. For example, you cannot chain commands like in sh -c "echo FOO && echo BAR", or execute echo FOO.

You just can execute the command such as whoami, ls and etc in the CLI command.

I suggest that you can run the command to create an interactive session with the container instance to execute command continuously after you create the ACI, refer to this similar issue.