> For the complete documentation index, see [llms.txt](https://docs.portainer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.portainer.io/portainer-documentation/3.0-sts/user/docker/containers/attach-volume.md).

# Attach a volume to a container

{% hint style="danger" %}
This article explains how to attach a new [volume](/portainer-documentation/3.0-sts/user/docker/volumes.md) to a running container. This operation destroys the running container and starts a new one with the volume attached.

**Always back up your data before running this operation.**
{% endhint %}

From the menu select **Containers**, select the container that you want to attach a volume to, then click **Duplicate/Edit**.

<figure><img src="https://content.gitbook.com/content/NaHIkLFUk78GrFLS4raF/blobs/1ZWNqoeHhPC3MWRc1xax/duplicate-container.gif" alt=""><figcaption></figcaption></figure>

Scroll down to **Advanced container settings**. Click **Volumes** then click **map additional volume**.

<figure><img src="https://content.gitbook.com/content/NaHIkLFUk78GrFLS4raF/blobs/zgHTeRjXv42nlZJYmMC1/2.15-docker_containers_container_add_volumes.png" alt=""><figcaption></figcaption></figure>

In the **container** field enter the path. In the **volume** field enter the volume to attach to the container.

<figure><img src="https://content.gitbook.com/content/NaHIkLFUk78GrFLS4raF/blobs/3r2oj2YK5nJ3K9w7eB4S/2.15-docker_containers_container_adv_volume_mapping.png" alt=""><figcaption></figcaption></figure>

When you're ready, click **Deploy the container**. When the confirmation message appears, click **Replace**.

<figure><img src="https://content.gitbook.com/content/NaHIkLFUk78GrFLS4raF/blobs/BG8ZmIMIaOtJZeuSecPP/2.15-container-edit-confirm.png" alt=""><figcaption></figcaption></figure>
