Creating Docker volumes

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 commandUsage: 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 parametersdocker volume create

Executing the preceding command will create a new Docker volume and ...

Get Docker Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.