コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public void Dispose()
 {
     _docker.Containers.RemoveContainerAsync(Id, new ContainerRemoveParameters {
         Force = true
     });
     _docker.Dispose();
 }
コード例 #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);
        }
コード例 #4
0
ファイル: MQListener.cs プロジェクト: Abingcbc/MLab-Csharp
 public override void Dispose()
 {
     connection.Close();
     channel.Close();
     base.Dispose();
     client.Dispose();
 }
コード例 #5
0
        public virtual void Dispose()
        {
            var removeParameters = new ContainerRemoveParameters();

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

            Client.Dispose();
        }
コード例 #6
0
ファイル: DockerService.cs プロジェクト: Pierre48/OraDocker
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_client != null)
         {
             _client.Dispose();
         }
     }
 }
コード例 #7
0
        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();
            }
        }
コード例 #8
0
 public void Dispose()
 {
     if (_dockerAppClient != null)
     {
         _dockerAppClient.Dispose();
     }
     if (_dockerBenchmarkClient != null)
     {
         _dockerBenchmarkClient.Dispose();
     }
 }
コード例 #9
0
        public void Dispose()
        {
            Stop();

            if (_rm)
            {
                Remove();
            }

            _client.Dispose();
        }
コード例 #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();
            }
        }
コード例 #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();
            }
        }
コード例 #12
0
        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();
            }
        }
コード例 #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();
            }
        }
コード例 #14
0
ファイル: DockerContainer.cs プロジェクト: zellus/Evolve
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _client.Dispose();
                }

                _disposedValue = true;
            }
        }
コード例 #15
0
        private bool disposedValue = false; // To detect redundant calls

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

                disposedValue = true;
            }
        }
コード例 #16
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    _dockerClient.Dispose();
                }

                _disposed = true;
            }
        }
コード例 #17
0
 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();
     }
 }
コード例 #18
0
        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();
        }
コード例 #19
0
        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();
            }
        }
コード例 #20
0
        public async Task DisposeAsync()
        {
            if (_client != null)
            {
                foreach (var containerInstance in _containerInstances)
                {
                    await Task.Delay(1);

                    //await containerInstance.Dispose();
                }

                _client.Dispose();
            }
        }
コード例 #21
0
        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();
            }
        }
コード例 #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);
        }
コード例 #23
0
ファイル: DockerContainer.cs プロジェクト: wkasa/Evolve
 public void Dispose() => _client.Dispose();
コード例 #24
0
 public void Dispose()
 {
     _client?.Dispose();
 }
コード例 #25
0
ファイル: DockerProxy.cs プロジェクト: wbskyboy/EasyNetQ
 public void Dispose()
 {
     dockerConfiguration.Dispose();
     client.Dispose();
 }
コード例 #26
0
        public void OneTimeTearDown()
        {
            StopRedisContainer();

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