Example #1
0
        public static async Task EnsureImageExistsAndCleanupAsync(DockerClient client, string imageName, string imageTag, string containerName)
        {
            await DockerExtentions.EnsureImageExistsAsync(client, imageName, imageTag);

            var container = await DockerExtentions.GetContainerAsync(client, containerName);

            if (container != null)
            {
                // await client.Containers.StopContainerAsync(container.ID, new ContainerStopParameters());
                await client.Containers.RemoveContainerAsync(container.ID, new ContainerRemoveParameters { Force = true });
            }
        }