public override Task <Response> HandleAsync() { return(Task.Run <Response>(async() => { var config = new WardenConfig(); var handle = new ContainerHandle(); var containerService = new ContainerService( config.ContainerBasePath, config.WardenUsersGroup); var containerSpec = new ContainerSpec { Handle = handle, BindMounts = GetBindMounts(request).ToArray(), }; var container = containerService.CreateContainer(containerSpec); var containerClient = new ContainerClient(containerService, container, new FileSystemManager()); await containerClient.InitializeAsync(null, null, null); containerManager.AddContainer(containerClient); return new CreateResponse { Handle = handle }; })); }
private static Tuple <DirectoryInfo, string> GetContainerDirectoryInfo(ContainerHandle handle) { var config = new WardenConfig(); string containerBasePath = config.ContainerBasePath; string containerDirectory = Path.Combine(containerBasePath, handle); return(new Tuple <DirectoryInfo, string>(new DirectoryInfo(containerBasePath), containerDirectory)); }