Container Instane Exec API

Sameer 0 Reputation points

The API$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.ContainerInstance/containerGroups/$groupName/containers/$containerName/exec?api-version=2023-05-01 returns a web socket URL with password.

Is there any documentation about how to invoke it with a client such as curl or websocat ?

Azure CLI az container exec automatically opens web socket but does not provide any details when used with --debug option.

Would Java API class ContainerExec also automatically interact with WebSocket and provide stdout of the command?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
635 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anveshreddy Nimmala 2,225 Reputation points Microsoft Vendor

    Hello Sameer,

    Welcome to microsoft Q&A, Thankyou for posting your query here.

    There is no specific documentation available for invoking the web socket URL returned by the API using a client such as curl or websocat.

    you can use the Azure CLI az container exec command to automatically open the web socket and interact with it.

    az container exec -g MyResourceGroup --name mynginx --container-name nginx --exec-command "/bin/bash"

    The --debug option in the az container exec command doesn't provide details about the WebSocket URL because it's primarily meant for debugging the Azure CLI itself, not the WebSocket connection or command execution within the container.

    When you use --debug, it generates verbose output, including HTTP requests and responses exchanged between the Azure CLI and Azure services.

    The ContainerExec class in the Azure Java SDK doesn't inherently interact with WebSocket or provide stdout of the command automatically.Hope this helps you.If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!