1

I need to mount 2 separate directories as volumes to a newly creted container. So far I've found the way to mount only one volume since there's no way to add a file share volume via withNewAzureFileShareVolume more than once.

Here's my code:

ContainerGroup containerGroup = azure.containerGroups()
                .define(containerName)
                .withRegion(Region.US_EAST)
                .withExistingResourceGroup("myResourceGroup")
                .withLinux()
                .withPrivateImageRegistry("registry")
                .withNewAzureFileShareVolume("aci-share", shareName)
                .defineContainerInstance(containerName)
                .withImage("image")
                .withVolumeMountSetting("aci-share", "/usr/local/dir1/")
                .withVolumeMountSetting("aci-share-2", "/usr/local/dir2/")
                .attach()
                .withDnsPrefix(team)
                .create();

A new storage account gets created with a single file share and I get the following error: Volumes 'aci-share-2' in container 'team44783530d' are not found

iozee
  • 1,339
  • 1
  • 12
  • 24
  • 1
    According to the situation, I think you can try to use Azure ARM template to implement it. For more details, please refer to https://learn.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#mount-multiple-volumes – Jim Xu Apr 02 '20 at 02:16
  • Here's the answer from MS Support on GitHub: https://github.com/MicrosoftDocs/azure-docs/issues/51457 – iozee Apr 20 '20 at 11:40

0 Answers0