DockerSdk
the .NET SDK for Docker
Public Member Functions | List of all members
DockerSdk.Builders.Builder Class Reference

Provides functionality to build Docker images. More...

Public Member Functions

 Builder (DockerClient client)
 Instantiates an instance of the Builder class. More...
 
async Task< IImageBuildAsync (IBundle bundle, BuildOptions options, CancellationToken ct=default)
 Creates a new image from a Dockerfile. More...
 
async Task< IImageBuildAsync (string contextPath, IEnumerable< string > filePaths, BuildOptions options, CancellationToken ct=default)
 Creates a new image from a Dockerfile. More...
 
async Task< IImageBuildAsync (string contextPath, string dockerfilePath, IEnumerable< string > filePaths, BuildOptions options, CancellationToken ct=default)
 Creates a new image from a Dockerfile. More...
 

Detailed Description

Provides functionality to build Docker images.

Constructor & Destructor Documentation

◆ Builder()

DockerSdk.Builders.Builder.Builder ( DockerClient  client)
inline

Instantiates an instance of the Builder class.

Parameters
clientA connection to the Docker daemon to use.

Member Function Documentation

◆ BuildAsync() [1/3]

async Task<IImage> DockerSdk.Builders.Builder.BuildAsync ( IBundle  bundle,
BuildOptions  options,
CancellationToken  ct = default 
)
inline

Creates a new image from a Dockerfile.

Parameters
bundleA package of the Dockerfile with any other files that need to be available to the build process.
optionsSpecifies how to create the image.
ctA token used to cancel the operation.
Returns
A Task<Result> that resolves when the image has been built and is available locally.
Exceptions
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as loss of network connectivity.
DockerImageBuildExceptionThe build failed.

◆ BuildAsync() [2/3]

async Task<IImage> DockerSdk.Builders.Builder.BuildAsync ( string  contextPath,
IEnumerable< string >  filePaths,
BuildOptions  options,
CancellationToken  ct = default 
)
inline

Creates a new image from a Dockerfile.

Parameters
contextPathThe path to the folder containing the Dockerfile and that serves as the context root for files specified in filePaths . If this is a relative path, it's taken as relative to the process's current working path.
filePathsThe paths to additional files to make available to the build process. These files must all be within the context path ( contextPath ). Any relative paths are taken as relative to the context path.
optionsSpecifies how to create the image.
ctA token used to cancel the operation.
Returns
A Task<Result> that resolves when the image has been built and is available locally.
Exceptions
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as loss of network connectivity.
ArgumentExceptionOne or more of the files are not located within the context path.
IOExceptionAn I/O error occurred while trying to read one of the files.
UnauthorizedAccessExceptionEither one of the files is a actually directory, or the process does not have permission to access one of the local files.
NotSupportedExceptionOne of the file paths is in an invalid format.
DockerImageBuildExceptionThe build failed.

◆ BuildAsync() [3/3]

async Task<IImage> DockerSdk.Builders.Builder.BuildAsync ( string  contextPath,
string  dockerfilePath,
IEnumerable< string >  filePaths,
BuildOptions  options,
CancellationToken  ct = default 
)
inline

Creates a new image from a Dockerfile.

Parameters
contextPathThe path to the folder that serves as the context root for files specified in dockerfilePath and filePaths . If this is a relative path, it's taken as relative to the process's current working path.
dockerfilePathThe path to the Dockerfile. This file must be within the context path ( contextPath ). If this is a relative path, it's taken as relative to the context path.
filePathsThe paths to additional files to make available to the build process. These files must all be within the context path ( contextPath ). Any relative paths are taken as relative to the context path.
optionsSpecifies how to create the image.
ctA token used to cancel the operation.
Returns
A Task<Result> that resolves when the image has been built and is available locally.
Exceptions
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as loss of network connectivity.
ArgumentExceptionOne or more of the files are not located within the context path.
IOExceptionAn I/O error occurred while trying to read one of the files.
UnauthorizedAccessExceptionEither one of the files is a actually directory, or the process does not have permission to access one of the local files.
NotSupportedExceptionOne of the file paths is in an invalid format.
DockerImageBuildExceptionThe build failed.

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