Overview:

This process intends to delete volumes in a docker based environment

The process can be done in two ways: Using Terminal or using Portainer

Delete Volume Using Terminal and command:

In this method we will use terminal to delete the volumes if Portainer/UI based software is not installed 

Go to the directory containing docker volumes, if using default settings go to 

cd /var/lib/docker/volumes
BASH


List of all the volumes will be shown in the directory, choose the appropriate volume to delete and execute

docker volume rm < volume >
BASH


After executing the command, if you receive the volume name, then the volume is successfully deleted 

Here is an example to show how things will work


Delete Volume Using Portainer UI:

In this method we are using Portainer to delete the volumes, Portainer is present in all our docker based environment 


Login to portainer.io by accessing <ip:portainer port number> for example https://10.2.9.132:9000 from the browser 

Go to left Menu options→ volumes

select all the volumes except portainer_data â†’ click Remove to remove all the volumes


Note

  • Make sure you always do docker-compose down before deleting any volumes
  • Only delete volumes related to the stack you are working on
  • Do not delete Portainer_data volume, or you will have to re apply all the configurations for Portainer