> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-volume.md).

# Cybus::Volume

Keep container data on disk when you disable, reinstall, or uninstall a service, and provide files to the containers of the service.

The **Cybus::Volume** resource creates a Docker volume that [containers](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-container.md) can mount. Use a volume when a container needs persistent storage. The data in the volume stays available even after you disable or uninstall the service.

{% hint style="warning" %}
This resource works only in Docker Compose deployments of Connectware. In a Kubernetes deployment, it results in an error.
{% endhint %}

## Lifecycle of a Volume

* **Creation**: If the volume does not exist yet when you enable the service, Connectware creates it automatically.
* **Persistence**: Once created, the volume stays. Connectware does not delete or truncate it, neither when you disable the service nor at any other time.
* **Manual cleanup**: The volume remains in place even when you install, enable, disable, or uninstall services. To free up its disk space, you must delete the volume manually.

Connectware names the Docker volume after the [service ID](https://docs.cybus.io/data-flows/services/serviceid.md) and the [resource ID](https://docs.cybus.io/data-flows/service-commissioning-files/resources.md#resource-id), joined by a hyphen, for example `myService-myVolume`. If you install the service again with the same service ID, its containers get the existing volume and its data.

Because of this lifecycle, you can reuse volumes across different services and deployments. This makes them suitable wherever you need persistent data storage.

## Files and Containers

To provide configuration or data files in the volume, add [Cybus::File](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-file.md) resources. Connectware writes them into the volume automatically when you enable the service. To use the volume in a container, list it in the [volumes](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-container.md#volumes) property of the [Cybus::Container](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-container.md) resource.

## Example

A volume has no properties. The container in this example mounts the volume at `/data`:

{% code lineNumbers="true" %}

```yaml
myVolume:
  type: Cybus::Volume

myServiceContainer:
  type: Cybus::Container
  properties:
    image: registry.cybus.io/cybus-services/baz-dashboard:0.2.0
    volumes:
      - !sub '${myVolume}:/data'
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-volume.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
