Watch Aspire live streamsDocsTry Aspire

IComputeEnvironmentWithVolumeMounts

Interfacenet10.0
📦 Aspire.Hosting v13.6.0
Implemented by compute environments that materialize volume mounts for the workloads they host.
namespace Aspire.Hosting.ApplicationModel;
public interface IComputeEnvironmentWithVolumeMounts
: Aspire.Hosting.ApplicationModel.IComputeEnvironmentResource,
Aspire.Hosting.ApplicationModel.IResource
{
// ...
}

Binding a volume to an environment variable promises the workload that reading that variable yields a path backed by storage. Only a compute environment that consumes ContainerMountAnnotation can keep that promise, so those environments declare the capability by implementing this interface.

When the target environment does not implement this interface, resolving the variable fails at publish time rather than emitting a path that resolves to ordinary writable container storage. Without the check the failure is silent and late: writes succeed, and the data disappears when the workload restarts or is rescheduled.