# WithDataVolume

- Module: [Aspire.Hosting.Keycloak](/reference/api/go/aspire.hosting.keycloak.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: [`KeycloakResource`](/reference/api/go/aspire.hosting.keycloak/keycloakresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Adds a named volume for the data folder to a Keycloak container resource.

## Remarks

The volume is mounted at /opt/keycloak/data in the container.
Use a data volume
```
var keycloak = builder.AddKeycloak("keycloak")
.WithDataVolume();
```

## Definition

```go
func (KeycloakResource) WithDataVolume(options ...*WithDataVolumeOptions) KeycloakResource
```

## Parameters

- `options` (`...*WithDataVolumeOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithDataVolumeOptions` argument.

- `Name` (`*string`) -- The name of the volume. Defaults to an auto-generated name based on the application and resource names.

## Returns

[`KeycloakResource`](/reference/api/go/aspire.hosting.keycloak/keycloakresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`KeycloakResource`](/reference/api/go/aspire.hosting.keycloak/keycloakresource.md)
