ChristopherDunderdale-2123 avatar image
0 Votes"
ChristopherDunderdale-2123 asked shivapatpi-MSFT commented

Defining ACI instance in C# with automatically generated Public IP

Hi - I've got two implementations for an Azure container Instance, one which automatically creates a public IP in the Container Instance Overview blade (or uses a default setting I'm not aware of) and one which does not allow me to set the public IP to be automatically generated.

In the code below the Azure CLI code deploys the container instance with an automatically assigned IP - I assume this is related to the --ip-address public call. In the F# equivalent code, I am required to supply a FQDN (or null), but the IP is not automatically assigned. Is there something obvious that I'm missing?

Just as a side - the F# code doesn't via the SDK does not produce a working ACI so I'm a bit puzzled what the problem is. It works perfectly with the Azure CLI and locally


Logging for ACI instances is only present the first time you create it (for some reason) - getting an additional error here which might help, but begs the question why it works in CLI, but not here. I've also tried tail -f /home with the same error and I know that the folder exists.

Error: Failed to start container <ContainerName>, Error response: to create containerd task: failed to create container <ContainerID>: guest RPC failure: failed to create container: failed to run runc create/exec call for container <ContainerID> with container_linux.go:349: starting container process caused "exec: \"tail -f /dev/null\": stat tail -f /dev/null: no such file or directory": exit status 1: unknown

I've been comparing the ARM templates between the CLI and SDK. Just noticed something different in the way the commands are defined for CLI compared to SDK. I've uploaded both. below. the Command part of the definition. This might be nothing, but thought I should point it out.
Azure CLI:

F# Code

"command": [
"tail -f /home"


Azure CLI Code

az container create --name [containerName] --image [ImageName] --ip-address public -g [RG] --azure-file-volume-account-key [StorageKey] --azure-file-volume-account-name [StorageAccountName] --azure-file-volume-share-name [FileShareName] --azure-file-volume-mount-path /specialfileshare --command-line "tail -f /dev/null"

F# Equivalent

mstsc-hizsayh4fe.png (140.2 KiB)
fsharp.txt (2.7 KiB)
azure-cli.txt (2.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @ChristopherDunderdale-2123 ,
I am internally following up on this issue as I come across this previously

Basically, this happens only when we are trying to mount a file share and running a command for that file share as a part of Container creation.
Previously, I was trying out the similar thing but using Powershell and coming across the same issue. Below is my script:

$volume = New-AzContainerGroupVolumeObject -Name "outputvolume" -AzureFileShareName "test" -AzureFileStorageAccountName $storageAccountName -AzureFileStorageAccountKey (ConvertTo-SecureString $sa_key -AsPlainText -Force)
$mount = New-AzContainerInstanceVolumeMountObject -MountPath "/work" -Name "outputvolume"
$container = New-AzContainerInstanceObject -Name test-container -Image -VolumeMount $mount -Command 'ls /work'
$containerGroup = New-AzContainerGroup -ResourceGroupName test-rg -Name test-using-powershell -Location eastus -Container $container -Volume $volume -RestartPolicy "Never"
Write-Host $containerGroup




0 Votes 0 ·
image.png (42.0 KiB)
image.png (17.0 KiB)
image.png (14.3 KiB)

0 Answers