ContainerResourceBuilderExtensions
Class static net10.0
Provides extension methods for
IDistributedApplicationBuilder to add container resources to the application. namespace Aspire.Hosting;
public static class ContainerResourceBuilderExtensions{ // ...} 37 members
Methods37
Section titled MethodsAddContainer(IDistributedApplicationBuilder, string, string)extensionIResourceBuilder<ContainerResource> Adds a container resource to the application. Uses the "latest" tag.
AddContainer(IDistributedApplicationBuilder, string, string, string)extensionIResourceBuilder<ContainerResource> Adds a container resource to the application.
AddDockerfile(IDistributedApplicationBuilder, string, string, string?, string?)extensionIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource.
AddDockerfileBuilder(IDistributedApplicationBuilder, string, string, Func<DockerfileBuilderCallbackContext, Task>, string?)extensionexperimentalIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile generated programmatically using the
DockerfileBuilder API. AddDockerfileBuilder(IDistributedApplicationBuilder, string, string, Action<DockerfileBuilderCallbackContext>, string?)extensionexperimentalIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile generated programmatically using the
DockerfileBuilder API. AddDockerfileFactory(IDistributedApplicationBuilder, string, string, Func<DockerfileFactoryContext, string>, string?)extensionIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile content generated by a synchronous factory function.
AddDockerfileFactory(IDistributedApplicationBuilder, string, string, Func<DockerfileFactoryContext, Task<string>>, string?)extensionIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile content generated by an asynchronous factory function.
PublishAsContainer(IResourceBuilder<T>)extension Changes the resource to be published as a container in the manifest.
WithBindMount(IResourceBuilder<T>, string, string, bool)extension Adds a bind mount to a container resource.
WithBuildArg(IResourceBuilder<T>, string, object?)extension Adds a build argument when the container is build from a Dockerfile.
WithBuildArg(IResourceBuilder<T>, string, IResourceBuilder<ParameterResource>)extension Adds a build argument when the container is built from a Dockerfile.
WithBuildSecret(IResourceBuilder<T>, string, IResourceBuilder<ParameterResource>)extension Adds a secret build argument when the container is built from a Dockerfile.
WithContainerCertificatePaths(IResourceBuilder<TResource>, string?, List<string>, List<string>)extensionIResourceBuilder<TResource> Adds a
ContainerCertificatePathsAnnotation to the resource that allows overriding the default paths in the container used for certificate trust. Custom certificate trust is only supported at run time. WithContainerFiles(IResourceBuilder<T>, string, IEnumerable<ContainerFileSystemItem>, int?, int?, UnixFileMode?)extension Creates or updates files and/or folders at the destination path in the container.
WithContainerFiles(IResourceBuilder<T>, string, Func<ContainerFileSystemCallbackContext, CancellationToken, Task<IEnumerable<ContainerFileSystemItem>>>, int?, int?, UnixFileMode?)extension Creates or updates files and/or folders at the destination path in the container. Receives a callback that will be invoked when the container is started to allow the files to be created based on other resources in the application model.
WithContainerFiles(IResourceBuilder<T>, string, string, int?, int?, UnixFileMode?)extension Creates or updates files and/or folders at the destination path in the container by copying them from a source path on the host. In run mode, this will copy the files from the host to the container at runtime, allowing for overriding ownership and permissions in the container. In publish mode, this will create a bind mount to the source path on the host.
WithContainerName(IResourceBuilder<T>, string)extension Overrides the default container name for this resource. By default Aspire generates a unique container name based on the resource name and a random postfix (or a postfix based on a hash of the AppHost project path for persistent container resources). This method allows you to override that behavior with a custom name, but could lead to naming conflicts if the specified name is not unique.
WithContainerNetworkAlias(IResourceBuilder<T>, string)extension Adds a network alias to container resource.
WithContainerRuntimeArgs(IResourceBuilder<T>, string[])extension Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.
WithContainerRuntimeArgs(IResourceBuilder<T>, Action<ContainerRuntimeArgsCallbackContext>)extension Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.
WithContainerRuntimeArgs(IResourceBuilder<T>, Func<ContainerRuntimeArgsCallbackContext, Task>)extension Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.
WithDockerfile(IResourceBuilder<T>, string, string?, string?)extension Causes .NET Aspire to build the specified container image from a Dockerfile.
WithDockerfileBaseImage(IResourceBuilder<T>, string?, string?)extensionexperimental Configures custom base images for generated Dockerfiles.
WithDockerfileBuilder(IResourceBuilder<T>, string, Func<DockerfileBuilderCallbackContext, Task>, string?)extensionexperimental Builds the specified container image from a Dockerfile generated by a callback using the
DockerfileBuilder API. WithDockerfileBuilder(IResourceBuilder<T>, string, Action<DockerfileBuilderCallbackContext>, string?)extensionexperimental Builds the specified container image from a Dockerfile generated by a synchronous callback using the
DockerfileBuilder API. WithDockerfileFactory(IResourceBuilder<T>, string, Func<DockerfileFactoryContext, string>, string?)extension Builds the specified container image from a Dockerfile generated by a synchronous factory function.
WithDockerfileFactory(IResourceBuilder<T>, string, Func<DockerfileFactoryContext, Task<string>>, string?)extension Builds the specified container image from a Dockerfile generated by an asynchronous factory function.
WithEndpointProxySupport(IResourceBuilder<T>, bool)extension Set whether a container resource can use proxied endpoints or whether they should be disabled for all endpoints belonging to the container. If set to
false, endpoints belonging to the container resource will ignore the configured proxy settings and run proxy-less. WithEntrypoint(IResourceBuilder<T>, string)extension Sets the Entrypoint for the container.
WithImage(IResourceBuilder<T>, string, string?)extension Allows overriding the image on a container.
WithImagePullPolicy(IResourceBuilder<T>, ImagePullPolicy)extension Sets the pull policy for the container resource.
WithImageRegistry(IResourceBuilder<T>, string?)extension Allows overriding the image registry on a container.
WithImageSHA256(IResourceBuilder<T>, string)extension Allows setting the image to a specific sha256 on a container.
WithImageTag(IResourceBuilder<T>, string)extension Allows overriding the image tag on a container.
WithLifetime(IResourceBuilder<T>, ContainerLifetime)extension Sets the lifetime behavior of the container resource.
WithVolume(IResourceBuilder<T>, string?, string, bool)extension Adds a volume to a container resource.
WithVolume(IResourceBuilder<T>, string)extension Adds an anonymous volume to a container resource.