# WithDataBindMount

- Module: [Aspire.Hosting.Valkey](/reference/api/go/aspire.hosting.valkey.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`ValkeyResource`](/reference/api/go/aspire.hosting.valkey/valkeyresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a bind mount for the data folder to a Valkey container resource and enables Valkey persistence.

## Definition

```go
func (ValkeyResource) WithDataBindMount(
    source string,
    options ...*WithDataBindMountOptions,
) ValkeyResource
```

## Parameters

- `source` (`string`) -- The source directory on the host to mount into the container.
- `options` (`...*WithDataBindMountOptions`) -- optional settings, see [Options](#options)

## Options

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

- `IsReadOnly` (`*bool`) -- A flag that indicates if this is a read-only mount. Setting this to `true` will disable Valkey persistence. Defaults to `false`.

## Returns

[`ValkeyResource`](/reference/api/go/aspire.hosting.valkey/valkeyresource.md) -- The resource builder.

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

## Applies to

- [`ValkeyResource`](/reference/api/go/aspire.hosting.valkey/valkeyresource.md)
