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();
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public override void Dispose()
 {
     connection.Close();
     channel.Close();
     base.Dispose();
     client.Dispose();
 }
Beispiel #5
0
        public virtual void Dispose()
        {
            var removeParameters = new ContainerRemoveParameters();

            removeParameters.Force = true;
            Client.Containers.RemoveContainerAsync(ID, removeParameters).Wait();

            Client.Dispose();
        }
Beispiel #6
0
 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();
            }
        }
Beispiel #8
0
 public void Dispose()
 {
     if (_dockerAppClient != null)
     {
         _dockerAppClient.Dispose();
     }
     if (_dockerBenchmarkClient != null)
     {
         _dockerBenchmarkClient.Dispose();
     }
 }
Beispiel #9
0
        public void Dispose()
        {
            Stop();

            if (_rm)
            {
                Remove();
            }

            _client.Dispose();
        }
Beispiel #10
0
        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();
            }
        }
Beispiel #11
0
        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();
            }
        }
Beispiel #13
0
        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();
            }
        }
Beispiel #14
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _client.Dispose();
                }

                _disposedValue = true;
            }
        }
Beispiel #15
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    dockerClient?.Dispose();
                }

                disposedValue = true;
            }
        }
Beispiel #16
0
        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();
            }
        }
Beispiel #22
0
        /// <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);
        }
Beispiel #23
0
 public void Dispose() => _client.Dispose();
Beispiel #24
0
 public void Dispose()
 {
     _client?.Dispose();
 }
Beispiel #25
0
 public void Dispose()
 {
     dockerConfiguration.Dispose();
     client.Dispose();
 }
Beispiel #26
0
        public void OneTimeTearDown()
        {
            StopRedisContainer();

            _dockerClient.Dispose();
        }
Beispiel #27
0
 public void Dispose()
 {
     _dockerClient?.Dispose();
 }
Beispiel #28
0
 public override void Dispose()
 {
     Client?.Dispose();
     Client = null;
     base.Dispose();
 }
 public void Dispose()
 {
     docker.RemoveContainerIfExist(MongoDbContainerName).Wait();
     docker.Dispose();
 }