# ContainerLifetime

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `enum`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Lifetime modes for container resources.

## Definition

```go
type ContainerLifetime string

const (
    ContainerLifetimeSession    ContainerLifetime = "Session"
    ContainerLifetimePersistent ContainerLifetime = "Persistent"
)
```

## Values

- `ContainerLifetimeSession` = `"Session"` -- Create the resource when the AppHost process starts and dispose of it when the AppHost process shuts down.
- `ContainerLifetimePersistent` = `"Persistent"` -- Attempt to re-use a previously created resource (based on the container name) if one exists. Do not destroy the container on AppHost process shutdown.
