private TaskContainerSettings CreateTaskContainerSettings(string dockerContainerId) { if (!AreContainersEnabled) { return(null); } string portMappings = Ports .Aggregate(seed: string.Empty, func: (aggregator, port) => $"{aggregator} -p {port}:{port}"); return(new TaskContainerSettings( imageName: ContainerRegistryProvider.ContainerImageName, containerRunOptions: $"-d --rm --name {dockerContainerId} --env HOST_IP_ADDR_PATH={CommandBuilder.GetIpAddressFilePath()} {portMappings}", registry: ContainerRegistryProvider.GetContainerRegistry())); }
public AzureBatchService( ContainerRegistryProvider containerRegistryProvider, ICommandBuilder commandBuilder, [Parameter(typeof(AzureBatchAccountUri))] string azureBatchAccountUri, [Parameter(typeof(AzureBatchAccountName))] string azureBatchAccountName, [Parameter(typeof(AzureBatchAccountKey))] string azureBatchAccountKey, [Parameter(typeof(AzureBatchPoolId))] string azureBatchPoolId, [Parameter(typeof(AzureBatchPoolDriverPortsList))] IList <string> ports) { BatchSharedKeyCredential credentials = new BatchSharedKeyCredential(azureBatchAccountUri, azureBatchAccountName, azureBatchAccountKey); Ports = ports; Client = BatchClient.Open(credentials); Credentials = credentials; PoolId = azureBatchPoolId; ContainerRegistryProvider = containerRegistryProvider; Client.CustomBehaviors.Add(new RetryPolicyProvider(new ExponentialRetry(RetryDeltaBackOff, MaxRetries))); CommandBuilder = commandBuilder; }