Skip to content
Docs Try Aspire

IContainerRuntime Methods

Interface Methods 6 members
Represents a container runtime (e.g., Docker, Podman) that can be used to build, tag, push, and manage container images.
BuildImageAsync(string, string, ContainerImageBuildOptions?, Dictionary<string, string?>, Dictionary<string, string?>, string?, CancellationToken) Section titled BuildImageAsync(string, string, ContainerImageBuildOptions?, Dictionary<string, string?>, Dictionary<string, string?>, string?, CancellationToken) abstract Task
Builds a container image from a Dockerfile.
public interface IContainerRuntime
{
public abstract Task BuildImageAsync(
string contextPath,
string dockerfilePath,
ContainerImageBuildOptions? options,
Dictionary<string, string?> buildArguments,
Dictionary<string, string?> buildSecrets,
string? stage,
CancellationToken cancellationToken)
{
// ...
}
}
contextPath string The build context path.
dockerfilePath string The path to the Dockerfile.
options ContainerImageBuildOptions? Build options including image name and tag.
buildArguments Dictionary<string, string?> Build arguments to pass to the build process.
buildSecrets Dictionary<string, string?> Build secrets to pass to the build process.
stage string? The target build stage.
cancellationToken CancellationToken A token to cancel the operation.
CheckIfRunningAsync(CancellationToken) Section titled CheckIfRunningAsync(CancellationToken) abstract Task<bool>
Checks if the container runtime is running and available.
public interface IContainerRuntime
{
public abstract Task<bool> CheckIfRunningAsync(
CancellationToken cancellationToken)
{
// ...
}
}
cancellationToken CancellationToken A token to cancel the operation.
Task<bool> True if the container runtime is running; otherwise, false.
LoginToRegistryAsync(string, string, string, CancellationToken) Section titled LoginToRegistryAsync(string, string, string, CancellationToken) abstract Task
Logs in to a container registry.
public interface IContainerRuntime
{
public abstract Task LoginToRegistryAsync(
string registryServer,
string username,
string password,
CancellationToken cancellationToken)
{
// ...
}
}
registryServer string The registry server URL.
username string The username for authentication.
password string The password for authentication.
cancellationToken CancellationToken A token to cancel the operation.
PushImageAsync(IResource, CancellationToken) Section titled PushImageAsync(IResource, CancellationToken) abstract Task
Pushes a container image to a registry.
public interface IContainerRuntime
{
public abstract Task PushImageAsync(
IResource resource,
CancellationToken cancellationToken)
{
// ...
}
}
resource IResource The resource containing push configuration.
cancellationToken CancellationToken A token to cancel the operation.
RemoveImageAsync(string, CancellationToken) Section titled RemoveImageAsync(string, CancellationToken) abstract Task
Removes a container image.
public interface IContainerRuntime
{
public abstract Task RemoveImageAsync(
string imageName,
CancellationToken cancellationToken)
{
// ...
}
}
imageName string The name of the image to remove.
cancellationToken CancellationToken A token to cancel the operation.
TagImageAsync(string, string, CancellationToken) Section titled TagImageAsync(string, string, CancellationToken) abstract Task
Tags a container image with a new name.
public interface IContainerRuntime
{
public abstract Task TagImageAsync(
string localImageName,
string targetImageName,
CancellationToken cancellationToken)
{
// ...
}
}
localImageName string The current name of the image.
targetImageName string The new name to assign to the image.
cancellationToken CancellationToken A token to cancel the operation.