April 2017
Beginner
404 pages
9h 30m
English
The following code creates an image by downloading the image from the Docker Hub if required:
/// <summary> /// Creates a new Image by pulling from Docker Hub /// </summary> /// <returns></returns> public async static Task<Stream> CreateImage() { client = new DockerClientConfiguration (new Uri(containerHostUrl)).CreateClient(); return await client.Images.CreateImageAsync (new ImagesCreateParameters() { Parent = "microsoft/iis", Tag = "webserver" }, null); }
Few docker API endpoints stream responses; for example, creating images or monitoring docker events. We can obtain the events from the stream by using the following code:
CancellationTokenSource cancellation = new CancellationTokenSource(); Stream stream ...
Read now
Unlock full access