IContainerRuntime Methods
InterfaceMethods9 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, BuildImageSecretValue>, string?, CancellationToken)Section titled BuildImageAsync(string, string, ContainerImageBuildOptions?, Dictionary<string, string?>, Dictionary<string, BuildImageSecretValue>, string?, CancellationToken)abstractTask 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, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken) { // ... }}Parameters
contextPathstringThe build context path.dockerfilePathstringThe path to the Dockerfile.optionsContainerImageBuildOptions?Build options including image name and tag.buildArgumentsDictionary<string, string?>Build arguments to pass to the build process.buildSecretsDictionary<string, BuildImageSecretValue>Build secrets to pass to the build process.stagestring?The target build stage.cancellationTokenCancellationTokenA token to cancel the operation.CheckIfRunningAsync(CancellationToken)Section titled CheckIfRunningAsync(CancellationToken)abstractTask<bool> Checks if the container runtime is running and available.
public interface IContainerRuntime{ public abstract Task<bool> CheckIfRunningAsync( CancellationToken cancellationToken) { // ... }}Parameters
cancellationTokenCancellationTokenA token to cancel the operation.Returns
Task<bool>True if the container runtime is running; otherwise, false.ComposeDownAsync(ComposeOperationContext, CancellationToken)Section titled ComposeDownAsync(ComposeOperationContext, CancellationToken)abstractTask Stops and removes compose services.
public interface IContainerRuntime{ public abstract Task ComposeDownAsync( ComposeOperationContext context, CancellationToken cancellationToken) { // ... }}Parameters
contextComposeOperationContextThe compose operation parameters.cancellationTokenCancellationTokenA token to cancel the operation.Exceptions
DistributedApplicationExceptionThrown when the compose down command fails.ComposeListServicesAsync(ComposeOperationContext, CancellationToken)Section titled ComposeListServicesAsync(ComposeOperationContext, CancellationToken)abstractTask<IReadOnlyList<ComposeServiceInfo>> Lists the running services in a compose environment with their port mappings.
public interface IContainerRuntime{ public abstract Task<IReadOnlyList<ComposeServiceInfo>?> ComposeListServicesAsync( ComposeOperationContext context, CancellationToken cancellationToken) { // ... }}Parameters
contextComposeOperationContextThe compose operation parameters.cancellationTokenCancellationTokenA token to cancel the operation.Returns
Task<IReadOnlyList<ComposeServiceInfo>>A list of running services, or null if the query could not be completed.ComposeUpAsync(ComposeOperationContext, CancellationToken)Section titled ComposeUpAsync(ComposeOperationContext, CancellationToken)abstractTask Starts compose services in detached mode.
public interface IContainerRuntime{ public abstract Task ComposeUpAsync( ComposeOperationContext context, CancellationToken cancellationToken) { // ... }}Parameters
contextComposeOperationContextThe compose operation parameters.cancellationTokenCancellationTokenA token to cancel the operation.Exceptions
DistributedApplicationExceptionThrown when the compose up command fails.LoginToRegistryAsync(string, string, string, CancellationToken)Section titled LoginToRegistryAsync(string, string, string, CancellationToken)abstractTask Logs in to a container registry.
public interface IContainerRuntime{ public abstract Task LoginToRegistryAsync( string registryServer, string username, string password, CancellationToken cancellationToken) { // ... }}Parameters
registryServerstringThe registry server URL.usernamestringThe username for authentication.passwordstringThe password for authentication.cancellationTokenCancellationTokenA token to cancel the operation.PushImageAsync(IResource, CancellationToken)Section titled PushImageAsync(IResource, CancellationToken)abstractTask Pushes a container image to a registry.
public interface IContainerRuntime{ public abstract Task PushImageAsync( IResource resource, CancellationToken cancellationToken) { // ... }}Parameters
resourceIResourceThe resource containing push configuration.cancellationTokenCancellationTokenA token to cancel the operation.RemoveImageAsync(string, CancellationToken)Section titled RemoveImageAsync(string, CancellationToken)abstractTask Removes a container image.
public interface IContainerRuntime{ public abstract Task RemoveImageAsync( string imageName, CancellationToken cancellationToken) { // ... }}Parameters
imageNamestringThe name of the image to remove.cancellationTokenCancellationTokenA token to cancel the operation.TagImageAsync(string, string, CancellationToken)Section titled TagImageAsync(string, string, CancellationToken)abstractTask Tags a container image with a new name.
public interface IContainerRuntime{ public abstract Task TagImageAsync( string localImageName, string targetImageName, CancellationToken cancellationToken) { // ... }}Parameters
localImageNamestringThe current name of the image.targetImageNamestringThe new name to assign to the image.cancellationTokenCancellationTokenA token to cancel the operation.