Skip to content

Attach an existing Volume to a Container

Portainer can attach a new volume to a running container. Be advised that this operation destroys the running container and starts a new one with the volume attached. Backup your data before doing this operation.

Attaching a volume

Go to Containers and select the container that you want to attach a volume to.

volumes

Click Duplicate/Edit.

volumes

Scroll down to see the options for this container. Select Volumes and click Map an Additional Volume.

volumes

Next, type the path in the container, in the example below, for an NGINX container, the path to persist is "/usr/share/nginx/html". We also need to specify the volume created.

volumes

Finally, click Deploy The Container. You will receive the following warning:

volumes

If successful you will see the confirmation pop up at the top right of screen

volumes

To confirm the configuration of your container, select it and scroll to the volume configuration, you should see a similar screen to the below:

volumes

Notes

Contribute to these docs.