# Attach a volume to a container

{% hint style="danger" %}
This article explains how to attach a new [volume](https://docs.portainer.io/2.33-lts/user/docker/volumes) 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://3850702872-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXI7douejaBgpZ6CP2zJf%2Fuploads%2Fgit-blob-bb2aa1d81772906f1c1d1ee4c28b26e83aedce5a%2F2.15-docker_containers_container_edit.gif?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://3850702872-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXI7douejaBgpZ6CP2zJf%2Fuploads%2Fgit-blob-a0ed7bf8b02c9d4c7b63e4b8a9083eb96c89b6c7%2F2.15-docker_containers_container_add_volumes.png?alt=media" 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://3850702872-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXI7douejaBgpZ6CP2zJf%2Fuploads%2Fgit-blob-2936b7356b4de4c716eb89c5d190df1a6a9f7178%2F2.15-docker_containers_container_adv_volume_mapping.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://3850702872-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXI7douejaBgpZ6CP2zJf%2Fuploads%2Fgit-blob-559a897e4431e4c582ab996be0617b2abdb16ece%2F2.15-container-edit-confirm.png?alt=media" alt=""><figcaption></figcaption></figure>
