public void Pulls_runs_stops_image() { var client = new DockerClient(); client.PullImage("ubuntu"); var containerName = "lcldckr-test-container"; var id = client.RunImage("ubuntu", "latest", new RunArguments { Name = containerName, Interactive = true }); Assert.NotNull(id); var runningContainer = client .Ps(true, new[] { new NameFilter(containerName) }) .SingleOrDefault(); Assert.NotNull(runningContainer); Assert.Equal(containerName, runningContainer.Names.Single()); Assert.Equal(id.Substring(0, 12), runningContainer.ContainerId); id = client.StopContainer(containerName); Assert.NotNull(id); id = client.RemoveContainer(containerName); Assert.NotNull(id); }
internal void cleanup() { Task.WaitAll(containers.Values.Map(x => docker.RemoveContainer(x)).ToArray()); containers.Clear(); this.logs.Clear(); timeout = null; }
public void Force_remove() { var client = new DockerClient(); client.PullImage("ubuntu"); var containerName = "lcldckr-test-container"; var id = client.RunImage("ubuntu", "latest", new RunArguments { Name = containerName, Interactive = true }); Assert.NotNull(id); id = client.RemoveContainer(containerName, force: true); Assert.NotNull(id); }