DockerSdk
the .NET SDK for Docker
|
Represents a Docker image, which is a read-only template for creating containers. More...
Public Member Functions | |
Task< IImageInfo > | GetDetailsAsync (CancellationToken ct=default) |
Gets detailed information about the image. More... | |
Task< IContainer > | RunAsync (CancellationToken ct=default) |
Creates a new container from this image and starts it. More... | |
Task< IContainer > | RunAsync (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... | |
Represents a Docker image, which is a read-only template for creating containers.
Task<IImageInfo> DockerSdk.Images.IImage.GetDetailsAsync | ( | CancellationToken | ct = default | ) |
Gets detailed information about the image.
ct | A CancellationToken used to cancel the operation. |
InvalidOperationException | The image no longer exists. |
System.Net.Http.HttpRequestException | The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation, or timeout. |
Task<IContainer> DockerSdk.Images.IImage.RunAsync | ( | CancellationToken | ct = default | ) |
Creates a new container from this image and starts it.
ct |
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.
Task<IContainer> DockerSdk.Images.IImage.RunAsync | ( | CreateContainerOptions | options, |
CancellationToken | ct = default |
||
) |
Creates a new container from this image and starts it.
options | Settings for the new container. |
ct |
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.
ArgumentException | options is null. |
ImageNotFoundLocallyException | The Docker daemon can no longer find the image locally, and the CreateContainerOptions.PullCondition option is not set to pull it automatically. |
ImageNotFoundRemotelyException | The Docker image no longer exists, even remotely. (Only applies when pulling an image, which is not enabled by default.) |
NetworkNotFoundException | One of the networks specified does not exist. |
MalformedReferenceException | The options specified a name for the image, but the name does not meet the expectations of a well-formed container name. |
RegistryAuthException | The 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.HttpRequestException | The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation, or timeout. |
|
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.)