4

Is there a way to execute a command in a container hosted in ACI? I'm looking for something like this:

docker container exec [image] [command]
Dave Swersky
  • 34,502
  • 9
  • 78
  • 118

3 Answers3

2

You can use the Azure CLI tools, with a command like:

az container exec -g container-group --name container-name --exec-command "/bin/bash"

For more information, see this document: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-exec

However, I've noticed that I currently cannot select the user to run the command as (such as docker exec -u "user").

Christian
  • 1,900
  • 14
  • 19
2
az container exec --resource-group myResourceGroup --name <name of cotainer group> --container-name <name of container app> --exec-command "/bin/bash"

Source Execute Commands in Azure Container Instances

0

Not yet, but it's on our list. For the moment, the best you can do is SSHing into the container and running your command that way.

Sean McKenna
  • 3,706
  • 19
  • 19
  • 3
    Can you point me to information on how I can do that with an ACI container? There's no indication in the documentation where/how to connect. Would I do it through the public IP? – Dave Swersky Sep 21 '17 at 19:14