private async void button5_Click(object sender, EventArgs e) { int chooise = comboBox1.SelectedIndex; if (chooise == -1) { return; } List <string> getconn = DockerConnectionStrs[chooise]; if (client != null) { client.Dispose(); } if (getconn[2] == "false") { client = new DockerClientConfiguration(new Uri(getconn[3])).CreateClient(); label3.Text = "已经连接至" + comboBox1.SelectedItem.ToString(); } else if (getconn[2] == "true") { var credentials = new CertificateCredentials(new X509Certificate2(getconn[4], getconn[5])); var config = new DockerClientConfiguration(new Uri(getconn[3]), credentials); client = config.CreateClient(); label3.Text = "已经连接至" + comboBox1.SelectedItem.ToString(); } else { label3.Text = "数据错误"; } try { listBox1.Items.Clear(); if (client != null) { IList <ContainerListResponse> containers = await client.Containers.ListContainersAsync( new ContainersListParameters() { Limit = 10, }); foreach (ContainerListResponse c in containers) { listBox1.Items.Add(c.ID.Substring(0, 12)); } } else { return; } } catch { MessageBox.Show("连接失败", "Error", MessageBoxButtons.OK); return; } }
public void Dispose() { _docker.Containers.RemoveContainerAsync(Id, new ContainerRemoveParameters { Force = true }); _docker.Dispose(); }
public CommandResult Execute(Command command) { var result = new CommandResult(); if (!(command.NiktoStandard || command.NmapStandard || command.XsserStandard)) { return(result); } StartContainer(); if (command.NmapStandard) { result.NmapResult = ExecuteCommandSync("nmap " + command.NmapAdditionalArgs + " " + command.Hostname); } if (command.NiktoStandard) { result.NiktoResult = ExecuteCommandSync("nikto " + command.NiktoAdditionalArgs + " " + command.Hostname); } if (command.XsserStandard) { result.XsserResult = ExecuteCommandSync("xsser " + command.XsserAdditionalArgs + " " + command.Hostname); } StopContainer(); _client.Dispose(); return(result); }
public override void Dispose() { connection.Close(); channel.Close(); base.Dispose(); client.Dispose(); }
public virtual void Dispose() { var removeParameters = new ContainerRemoveParameters(); removeParameters.Force = true; Client.Containers.RemoveContainerAsync(ID, removeParameters).Wait(); Client.Dispose(); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_client != null) { _client.Dispose(); } } }
public async Task DisposeAsync() { if (DockerClient != null) { await DockerClient.Containers.StopContainerAsync(RedisContainer, new ContainerStopParameters { }); await DockerClient.Containers.RemoveContainerAsync(RedisContainer, new ContainerRemoveParameters { Force = true }); DockerClient.Dispose(); } }
public void Dispose() { if (_dockerAppClient != null) { _dockerAppClient.Dispose(); } if (_dockerBenchmarkClient != null) { _dockerBenchmarkClient.Dispose(); } }
public void Dispose() { Stop(); if (_rm) { Remove(); } _client.Dispose(); }
public async Task DisposeAsync() { if (_client != null) { await _client.Containers.StopContainerAsync(_eventStoreContainerName, new ContainerStopParameters { }); await _client.Containers.RemoveContainerAsync(_eventStoreContainerName, new ContainerRemoveParameters { Force = true }); _client.Dispose(); } }
public async Task DisposeAsync() { if (Client != null) { await Client.Containers.StopContainerAsync(PostgresContainerName, new ContainerStopParameters()); await Client.Containers.RemoveContainerAsync(PostgresContainerName, new ContainerRemoveParameters { Force = true }); Client.Dispose(); } }
public virtual async Task DisposeAsync() { if (_client != null) { await _client.Containers.StopContainerAsync(_zipkinContainerName, new ContainerStopParameters()); await _client.Containers.RemoveContainerAsync(_zipkinContainerName, new ContainerRemoveParameters { Force = true }); _client.Dispose(); } }
public async Task CleanUp() { if (_client != null) { await _client.Containers.StopContainerAsync(_azureStorageContainerName, new ContainerStopParameters()); await _client.Containers.RemoveContainerAsync(_azureStorageContainerName, new ContainerRemoveParameters { Force = true }); _client.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _client.Dispose(); } _disposedValue = true; } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { dockerClient?.Dispose(); } disposedValue = true; } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { _dockerClient.Dispose(); } _disposed = true; } }
public void Dispose() { if (client != null) { client.Containers.StopContainerAsync(containerName, new ContainerStopParameters()).Wait(); client.Containers.RemoveContainerAsync(containerName, new ContainerRemoveParameters { Force = true, RemoveVolumes = true }).Wait(); client.Dispose(); } }
public async Task DisposeAsync() { Db.Close(); Db.Dispose(); //stop container if (await _client.Containers.StopContainerAsync(_containerResponse.ID, new ContainerStopParameters(), CancellationToken.None)) { //delete container await _client.Containers.RemoveContainerAsync(_containerResponse.ID, new ContainerRemoveParameters(), CancellationToken.None); } _client?.Dispose(); }
public async Task DisposeAsync() { if (_client != null) { // Shutdown running containers only when we were not using pre-existing container if (!TestsConfiguration.UseExistingDockerContainer) { await ResourceCleanup(); } _client.Dispose(); } }
public async Task DisposeAsync() { if (_client != null) { foreach (var containerInstance in _containerInstances) { await Task.Delay(1); //await containerInstance.Dispose(); } _client.Dispose(); } }
public async Task DisposeAsync() { if (Client != null) { // Delay to make sure that all tests has completed cleanup. await Task.Delay(TimeSpan.FromSeconds(5)); // Kill the container, we can't simply stop the container because Redis can hung indefinetly // if we simply stop the container. await Client.Containers.KillContainerAsync(RedisContainerName, new ContainerKillParameters()); await Client.Containers.RemoveContainerAsync(RedisContainerName, new ContainerRemoveParameters { Force = true }); Client.Dispose(); } }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } if (disposing && timer != null) { timer.Tick -= timer_Tick; } if (disposing && _dockerClient != null) { _dockerClient.Dispose(); _dockerClient = null; } base.Dispose(disposing); }
public void Dispose() => _client.Dispose();
public void Dispose() { _client?.Dispose(); }
public void Dispose() { dockerConfiguration.Dispose(); client.Dispose(); }
public void OneTimeTearDown() { StopRedisContainer(); _dockerClient.Dispose(); }
public void Dispose() { _dockerClient?.Dispose(); }
public override void Dispose() { Client?.Dispose(); Client = null; base.Dispose(); }
public void Dispose() { docker.RemoveContainerIfExist(MongoDbContainerName).Wait(); docker.Dispose(); }