How to Create, List, and Remove Docker Volume?
This article will demonstrate:
How to Create a Docker Volume?
To create a Docker volume, execute the “docker volume create <volume-name>” command in the Windows PowerShell:
Here, we have created a Docker volume named “test”:
How to List Docker Volumes?
Utilize the below-listed command to list all the Docker volumes:
In the below screenshot, three Docker volumes can be seen:
Moreover, the “ls” option can also be used with the “docker volume” command to display all volumes:
How to Remove Docker Volume?
To remove the specific Docker volume, run the “docker volume rm” command and specify the particular volume name that needs to be deleted:
Here, we want to remove the “Volume1” Docker volume:
To verify whether the desired volume has been deleted or not, execute the following command:
The below output indicates that the “Volume1” Docker volume has been deleted:
That was all about creating, listing, and removing Docker volume.
Conclusion
To create a Docker volume, utilize the “docker volume create <volume-name>” command. To list Docker volumes, run the “docker volume list” or “docker volume ls” command and to remove Docker volume, the “docker volume rm <volume-name>” command is used. This article demonstrated the methods for creating, listing, and removing Docker volumes.
Source: linuxhint.com