# ValkeyResource.WithDataBindMount

- Module: [Aspire.Hosting.Valkey](/reference/api/go/aspire.hosting.valkey.md)
- Defined on: [ValkeyResource](/reference/api/go/aspire.hosting.valkey/valkeyresource.md)
- Version: `17.0.0`
- Kind: `method`

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

## Definition

```go
type ValkeyResource interface {
    // ... omitted for brevity
    WithDataBindMount(
        source string,
        options ...*WithDataBindMountOptions,
    ) ValkeyResource
}
```

## Signature

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

## Defined on

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