ASPIRECONTAINERRUNTIME001
이 콘텐츠는 아직 번역되지 않았습니다.
Type is for evaluation purposes only and is subject to change or removal in future updates
This diagnostic warns when using the experimental IContainerRuntime interface and related container runtime implementations. These APIs provide abstraction over container runtimes like Docker and Podman for building, tagging, pushing, and managing container images during deployment.
Example generating diagnostic
Section titled “Example generating diagnostic”var builder = DistributedApplication.CreateBuilder(args);
// Using IContainerRuntimevar containerRuntime = builder.Services.BuildServiceProvider().GetRequiredService<IContainerRuntime>();var isRunning = await containerRuntime.CheckIfRunningAsync(cancellationToken);var runtimeName = containerRuntime.Name;The diagnostic is triggered because IContainerRuntime is marked with the [Experimental("ASPIRECONTAINERRUNTIME001")] attribute.
Understanding the diagnostic
Section titled “Understanding the diagnostic”The IContainerRuntime interface provides a unified abstraction for interacting with container runtimes:
- Runtime detection: Check if Docker or Podman is running and available
- Image building: Build container images from Dockerfiles with build arguments and secrets
- Image management: Tag, push, and remove container images
- Registry operations: Login to container registries for authentication
This API is experimental because the container runtime abstraction layer is being refined based on deployment scenario requirements, and the interface may evolve to support additional container runtime features or optimizations.
Related types
Section titled “Related types”IContainerRuntime: Interface representing a container runtime (Docker, Podman)DockerContainerRuntime: Implementation for Docker runtimePodmanContainerRuntime: Implementation for Podman runtimeCheckIfRunningAsync(): Verifies if the container runtime is availableBuildImageAsync(): Builds a container image from a DockerfileTagImageAsync(): Tags a container image with a new namePushImageAsync(): Pushes a container image to a registryRemoveImageAsync(): Removes a container imageLoginToRegistryAsync(): Authenticates with a container registry
Suppressing the diagnostic
Section titled “Suppressing the diagnostic”The diagnostic can be suppressed using one of several methods:
Suppressing in .editorconfig
Section titled “Suppressing in .editorconfig”[*.cs]dotnet_diagnostic.ASPIRECONTAINERRUNTIME001.severity = noneSuppressing in a project file
Section titled “Suppressing in a project file”<PropertyGroup> <NoWarn>$(NoWarn);ASPIRECONTAINERRUNTIME001</NoWarn></PropertyGroup>Suppressing in source code
Section titled “Suppressing in source code”#pragma warning disable ASPIRECONTAINERRUNTIME001var containerRuntime = builder.Services.BuildServiceProvider().GetRequiredService<IContainerRuntime>();var isRunning = await containerRuntime.CheckIfRunningAsync(cancellationToken);#pragma warning restore ASPIRECONTAINERRUNTIME001