There are a few ways to create a Docker volume. One way is to use the volume create command. The syntax for that command is as follows:
# Syntax for the volume create command
Usage: docker volume create [OPTIONS] [VOLUME]
In addition to the optional volume name parameter, the create command allows for these options:
# The options available to the volume create command:
-d, --driver string # Specify volume driver name (default "local")
--label list # Set metadata for a volume
-o, --opt map # Set driver specific options (default map[])
Let's start with the simplest example:
# Using the volume create command with no optional parameters
docker volume create
Executing the preceding command will create a new Docker volume and assign it a random name. The volume will be created using the built-in local driver (by...