Skip to content
DocsTry Aspire
DocsTry

ContainerImagePushOptions Methods

ClassMethods1 member
Represents options for pushing container images to a registry.
GetFullRemoteImageNameAsync(IContainerRegistry, CancellationToken)Section titled GetFullRemoteImageNameAsync(IContainerRegistry, CancellationToken)Task<string>
Gets the full remote image name including registry endpoint and tag.
public sealed class ContainerImagePushOptions
{
public Task<string> GetFullRemoteImageNameAsync(
IContainerRegistry registry,
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
registryIContainerRegistryThe container registry to use for constructing the full image name.
cancellationTokenCancellationTokenoptionalThe cancellation token.
Task<string> The fully qualified image name in the format "{registryEndpoint}/{repository}/{imageName}:{tag}" or "{registryEndpoint}/{imageName}:{tag}" if no repository is specified. For example: "myregistry.azurecr.io/myapp:v1.0.0" or "docker.io/captainsafia/myapp:latest".
InvalidOperationExceptionThrown when ContainerImagePushOptions.RemoteImageName is null or empty.
ArgumentNullExceptionThrown when registry is null.

This method retrieves the registry endpoint asynchronously and combines it with the remote image name and tag. If ContainerImagePushOptions.RemoteImageTag is null or empty, "latest" is used as the default tag.

The ContainerImagePushOptions.RemoteImageName value is parsed to determine if it contains an override for the registry host or repository. If the ContainerImagePushOptions.RemoteImageName contains a host component (detected by the presence of a dot in the first segment), that host will be used instead of the registry endpoint. Otherwise, the registry endpoint is used and the IContainerRegistry.Repository (if set) is prepended to the image name.