Пример #1
0
        public void Builds_and_runs_container()
        {
            var client = new DockerClient();

            var contextPath    = AppContext.BaseDirectory;
            var dockerFilePath = Path.Combine(contextPath, "Dockerfile");

            var imageId = client.Build(contextPath, dockerFilePath);

            var containerName = "lcldckr-build-test";

            client.RunImage(imageId, containerName);

            var container = client
                            .Ps(true, new[] { new NameFilter(containerName) })
                            .SingleOrDefault();

            Assert.NotNull(container);

            client.StopAndRemoveContainer(containerName);
        }