コード例 #1
0
        public async Task GetsLogs()
        {
            var containerName = "lcldkr-logs-test";
            var client        = new DockerClient();

            try
            {
                client.RunOrReplace(
                    "hello-world",
                    tag: null,
                    args: new RunArguments {
                    Name = containerName
                });

                await client.WaitForLogEntryAsync(containerName, "Hello from Docker!", TimeSpan.FromSeconds(30));

                var logString = client.Logs(containerName);

                Assert.Contains("Hello from Docker!", logString);
            }
            finally
            {
                client.StopAndRemoveContainer(containerName);
            }
        }
コード例 #2
0
        public async Task Waits_for_log_entry()
        {
            var client = new DockerClient();

            var containerName = "lcldkr-log-test";

            client.RunOrReplace("hello-world", containerName);

            await client.WaitForLogEntryAsync(containerName, "Hello from Docker!", TimeSpan.FromSeconds(30));

            client.StopAndRemoveContainer(containerName);
        }