IContainerRuntime Methods
InterfaceMethods11 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
contextPath stringThe build context path.dockerfilePath stringThe path to the Dockerfile.optionsContainerbuildArguments Dictionary<string, string?> Build arguments to pass to the build process.buildSecrets Dictionary<string, BuildImageSecretValue> Build secrets to pass to the build process.stagestring?The target build stage.cancellationToken CancellationToken A 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
cancellationToken CancellationToken A 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
contextComposecancellationToken CancellationToken A 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
contextComposecancellationToken CancellationToken A 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
contextComposecancellationToken CancellationToken A token to cancel the operation.Exceptions
DistributedApplicationExceptionThrown when the compose up command fails.InspectImageConfigAsync(string, CancellationToken) Section titled InspectImageConfigAsync(string, CancellationToken)virtualTask Inspects a container image configuration.
public interface IContainerRuntime{ public virtual Task<ContainerImageConfigInspectionResult> InspectImageConfigAsync( string imageName, CancellationToken cancellationToken) { // ... }}Parameters
imageName stringThe image name or reference to inspect.cancellationToken CancellationToken A token to cancel the operation.Returns
Task<ContainerImageConfigInspectionResult> The image configuration inspection result.InspectImageManifestAsync(string, CancellationToken) Section titled InspectImageManifestAsync(string, CancellationToken)virtualTask Inspects a container image manifest.
public interface IContainerRuntime{ public virtual Task<ContainerImageManifestInspectionResult> InspectImageManifestAsync( string imageName, CancellationToken cancellationToken) { // ... }}Parameters
imageName stringThe image name or reference to inspect.cancellationToken CancellationToken A token to cancel the operation.Returns
Task<ContainerImageManifestInspectionResult> The image manifest inspection result.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
registryServer stringThe registry server URL.usernamestringThe username for authentication.passwordstringThe password for authentication.cancellationToken CancellationToken A 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
resourceIcancellationToken CancellationToken A 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
imageName stringThe name of the image to remove.cancellationToken CancellationToken A 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
localImageName stringThe current name of the image.targetImageName stringThe new name to assign to the image.cancellationToken CancellationToken A token to cancel the operation.