示例#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);
            }
        }