C# 无法查看ACI容器中azure文件共享卷装载中的文件
我正在尝试将Azure文件共享卷装载到ACI容器组和实例 C#代码片段C# 无法查看ACI容器中azure文件共享卷装载中的文件,c#,azure,docker,azure-container-instances,C#,Azure,Docker,Azure Container Instances,我正在尝试将Azure文件共享卷装载到ACI容器组和实例 C#代码片段 .DefineVolume(volumeMountName) .WithExistingReadWriteAzureFileShare(shareName) .WithStorageAccountName(storageAccountName) .WithStorageAccountKey(storage
.DefineVolume(volumeMountName)
.WithExistingReadWriteAzureFileShare(shareName)
.WithStorageAccountName(storageAccountName)
.WithStorageAccountKey(storageAccountKey)
.Attach()
.DefineContainerInstance(containerGroupName)
.WithImage($"{acrServer}/{containerImage}:{Constant.ACIVersion}")
.WithExternalTcpPort(80)
.WithVolumeMountSetting(volumeMountName,"/aci/logs/")
.WithCpuCoreCount(1.0)
.WithMemorySizeInGB(1.5)
.WithEnvironmentVariables(envVars)
.Attach()
上面的代码运行良好,它在Azure中启动了ACI容器
但是,当我尝试从容器中列出文件时,例如:
Directory.GetFiles(“/aci/logs/z-vol/”)或Directory.GetFiles(“//z-vol/”)
我没有得到任何结果,而且当我写入此目录位置时,新文件不会反映在门户中的Azure文件共享中
我错过了什么?我正在运行ubuntu映像。我可以访问位于“/aci/logs/”的文件共享。卷装载名称“z-vol”对您访问文件的方式没有任何价值。是否进入容器内查看是否一切正常?我的容器在几秒钟内自行停止,因此我无法进入容器内。能否显示容器的日志?如果它停止了,我认为它有问题。你的代码是重复的还是什么?为什么它有
.attach()
两次?此外,您还可以使用类似于/bin/bash-c“ls/aci/logs
或类似命令启动容器,以查看该目录中是否装载了某些内容。