# ContainerLifetime

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

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.
