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

Represents a Docker container. More...

Inheritance diagram for DockerSdk.Containers.IContainer:
DockerSdk.Containers.IContainerInfo

Public Member Functions

Task AttachNetwork (NetworkReference network, CancellationToken ct=default)
 Attaches a Docker network to the container. More...
 
Task AttachNetwork (NetworkReference network, AttachNetworkOptions options, CancellationToken ct=default)
 Attaches a Docker network to the container. More...
 
Task AttachNetwork (string network, CancellationToken ct=default)
 Attaches a Docker network to the container. More...
 
Task AttachNetwork (string network, AttachNetworkOptions options, CancellationToken ct=default)
 Attaches a Docker network to the container. More...
 
Task< IContainerInfoGetDetailsAsync (CancellationToken ct=default)
 Gets detailed information about the container. More...
 
Task StartAsync (CancellationToken ct=default)
 Starts the container, if it is not already running. More...
 

Properties

ContainerFullId Id [get]
 Gets the container's full ID. More...
 

Detailed Description

Represents a Docker container.

Member Function Documentation

◆ AttachNetwork() [1/4]

Task DockerSdk.Containers.IContainer.AttachNetwork ( NetworkReference  network,
AttachNetworkOptions  options,
CancellationToken  ct = default 
)

Attaches a Docker network to the container.

Parameters
networkA reference to the network.
optionsOptions for how to perform the operation.
ctA token used to cancel the operation.
Returns
A Task that resolves when the network has been attached.
Exceptions
ArgumentNullExceptionOne or more of the inputs are null.
ArgumentExceptionThe options input has invalid values, such as an IPv6 address in the AttachNetworkOptions.IPv6Address property.
NetworkNotFoundExceptionThe indicated network does not exist.
ContainerNotFoundExceptionThe container 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.

◆ AttachNetwork() [2/4]

Task DockerSdk.Containers.IContainer.AttachNetwork ( NetworkReference  network,
CancellationToken  ct = default 
)

Attaches a Docker network to the container.

Parameters
networkA reference to the network.
ctA token used to cancel the operation.
Returns
A Task that resolves when the network has been attached.
Exceptions
ArgumentNullExceptionnetwork is null.
NetworkNotFoundExceptionThe indicated network does not exist.
ContainerNotFoundExceptionThe container 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.

◆ AttachNetwork() [3/4]

Task DockerSdk.Containers.IContainer.AttachNetwork ( string  network,
AttachNetworkOptions  options,
CancellationToken  ct = default 
)

Attaches a Docker network to the container.

Parameters
networkA reference to the network.
optionsOptions for how to perform the operation.
ctA token used to cancel the operation.
Returns
A Task that resolves when the network has been attached.
Exceptions
ArgumentNullExceptionOne or more of the inputs are null.
ArgumentExceptionThe options input has invalid values, such as an IPv6 address in the AttachNetworkOptions.IPv6Address property.
NetworkNotFoundExceptionThe indicated network does not exist.
MalformedReferenceExceptionnetwork is not a well-formed network reference.
ContainerNotFoundExceptionThe container 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.

◆ AttachNetwork() [4/4]

Task DockerSdk.Containers.IContainer.AttachNetwork ( string  network,
CancellationToken  ct = default 
)

Attaches a Docker network to the container.

Parameters
networkA reference to the network.
ctA token used to cancel the operation.
Returns
A Task that resolves when the network has been attached.
Exceptions
ArgumentNullExceptionnetwork is null.
NetworkNotFoundExceptionThe indicated network does not exist.
MalformedReferenceExceptionnetwork is not a well-formed network reference.
ContainerNotFoundExceptionThe container 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.

◆ GetDetailsAsync()

Task<IContainerInfo> DockerSdk.Containers.IContainer.GetDetailsAsync ( CancellationToken  ct = default)

Gets detailed information about the container.

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

◆ StartAsync()

Task DockerSdk.Containers.IContainer.StartAsync ( CancellationToken  ct = default)

Starts the container, if it is not already running.

Parameters
ctA token used to cancel the operation.
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
ContainerNotFoundExceptionThe indicated container no longer exists.
NetworkNotFoundExceptionOne of the networks specified during container creation does not exist.
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

ContainerFullId DockerSdk.Containers.IContainer.Id
get

Gets the container's full ID.


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