我有一个无状态 Service Fabric 项目 (.NET Core),我需要从中启动 Docker 作业。我正在使用Docker.DotNet
,以下代码在小型控制台应用程序中运行良好,但在 Service Fabric 中无法运行:
var dockerClient = new DockerClientConfiguration(new Uri("npipe://./pipe/docker_engine")).CreateClient();
// error occurs on next line (in Service Fabric)...
dockerClient.Images
.CreateImageAsync(new ImagesCreateParameters
{
FromImage = "jbarlow83/ocrmypdf",
Tag = "latest"
},
new AuthConfig(),
new Progress<JSONMessage>());
如果我尝试从 Stateless SF 项目运行它,我会在 Service Fabric Explorer 中看到此错误:
System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.DotNet.DockerClient.<>c__DisplayClass6_0.<<-ctor>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Net.Http.Client.ManagedHandler.d__33.MoveNext()
我不确定这是否真的是一个权限问题,或者它是否与 Service Fabric 网络隔离的工作方式有关。
我正在我的本地开发实例上尝试这个,最终(希望)会进入本地设置。
有没有办法访问托管 SF 应用程序的节点上的命名管道?或者也许是通过 .NET Core SF 应用程序运行 Docker 的另一种建议方式?