DockerSdk
the .NET SDK for Docker
Public Member Functions | Properties | List of all members
DockerSdk.Images.IImage Interface Reference

Represents a Docker image, which is a read-only template for creating containers. More...

Inheritance diagram for DockerSdk.Images.IImage:
DockerSdk.Images.IImageInfo

Public Member Functions

Task< IImageInfoGetDetailsAsync (CancellationToken ct=default)
 Gets detailed information about the image. More...
 
Task< IContainerRunAsync (CancellationToken ct=default)
 Creates a new container from this image and starts it. More...
 
Task< IContainerRunAsync (CreateContainerOptions options, CancellationToken ct=default)
 Creates a new container from this image and starts it. More...
 

Properties

ImageFullId Id [get]
 Gets the image's full ID. More...
 

Detailed Description

Represents a Docker image, which is a read-only template for creating containers.

See also
IImageInfo

Member Function Documentation

◆ GetDetailsAsync()

Task<IImageInfo> DockerSdk.Images.IImage.GetDetailsAsync ( CancellationToken  ct = default)

Gets detailed information about the image.

Parameters
ctA CancellationToken used to cancel the operation.
Returns
A Task that completes when the result is available.
Exceptions
InvalidOperationExceptionThe image no longer exists.
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation, or timeout.

◆ RunAsync() [1/2]

Task<IContainer> DockerSdk.Images.IImage.RunAsync ( CancellationToken  ct = default)

Creates a new container from this image and starts it.

Parameters
ct
Returns
A Task<TResult> that resolves when the container's main process has started.

From the perspective of Docker, there's no concept of whether the container's main process has "finished starting"–just that the process has been started at all. Thus, for example, if the process is a web server, this method's Task may resolve before the web server is ready for connections. If the application using this library needs to synchronize with events happening inside the container, it should monitor the container's logs or use other real-time mechanisms to do so.

It's also possible that a short-lived process might exit before the method's Task resolves.

◆ RunAsync() [2/2]

Task<IContainer> DockerSdk.Images.IImage.RunAsync ( CreateContainerOptions  options,
CancellationToken  ct = default 
)

Creates a new container from this image and starts it.

Parameters
optionsSettings for the new container.
ct
Returns
A Task<TResult> that resolves when the container's main process has started.

From the perspective of Docker, there's no concept of whether the container's main process has "finished starting"–just that the process has been started at all. Thus, for example, if the process is a web server, this method's Task may resolve before the web server is ready for connections. If the application using this library needs to synchronize with events happening inside the container, it should monitor the container's logs or use other real-time mechanisms to do so.

It's also possible that a short-lived process might exit before the method's Task resolves.

Exceptions
ArgumentExceptionoptions is null.
ImageNotFoundLocallyExceptionThe Docker daemon can no longer find the image locally, and the CreateContainerOptions.PullCondition option is not set to pull it automatically.
ImageNotFoundRemotelyExceptionThe Docker image no longer exists, even remotely. (Only applies when pulling an image, which is not enabled by default.)
NetworkNotFoundExceptionOne of the networks specified does not exist.
MalformedReferenceExceptionThe options specified a name for the image, but the name does not meet the expectations of a well-formed container name.
RegistryAuthExceptionThe registry requires credentials that the client hasn't been given. (Only applies when pulling an image, which is not enabled by default.)
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation, or timeout.

Property Documentation

◆ Id

ImageFullId DockerSdk.Images.IImage.Id
get

Gets the image's full ID.

This is a hash of the image's config file. Even with identical build inputs, this will be different for each build. (Except when you've hacking the process to prevent that.)


The documentation for this interface was generated from the following file: