# KeycloakResource.WithDataVolume

- Module: [Aspire.Hosting.Keycloak](/reference/api/go/aspire.hosting.keycloak.md)
- Defined on: [KeycloakResource](/reference/api/go/aspire.hosting.keycloak/keycloakresource.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`

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
type KeycloakResource interface {
    // ... omitted for brevity
    WithDataVolume(options ...*WithDataVolumeOptions) KeycloakResource
}
```

## Signature

```go
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()`.

## Defined on

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