The basis of volume-related commands is docker volume. The commands are as follows:
- $docker volume create: Creates a volume
- $ docker volume inspect: Displays detailed information on one or more volumes
- $docker volume ls: Lists volumes
- $ docker volume rm: removes one or more volumes
- $ docker volume prune: removes all unused volumes, which is all volumes that are no longer mapped into any container
Similar to network-related commands, you can get the detailed description and all the possible options for each command if you execute it with the -help switch, for example: docker volume create -help. Let's begin with creating a volume.