github.com/45cali/docker@v1.11.1/docs/reference/commandline/volume_create.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "volume create"
     4  description = "The volume create command description and usage"
     5  keywords = ["volume, create"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # volume create
    12  
    13      Usage: docker volume create [OPTIONS]
    14  
    15      Create a volume
    16  
    17        -d, --driver=local    Specify volume driver name
    18        --help                Print usage
    19        --label=[]            Set metadata for a volume
    20        --name=               Specify volume name
    21        -o, --opt=map[]       Set driver specific options
    22  
    23  Creates a new volume that containers can consume and store data in. If a name is not specified, Docker generates a random name. You create a volume and then configure the container to use it, for example:
    24  
    25  ```bash
    26  $ docker volume create --name hello
    27  hello
    28  
    29  $ docker run -d -v hello:/world busybox ls /world
    30  ```
    31  
    32  The mount is created inside the container's `/world` directory. Docker does not support relative paths for mount points inside the container.
    33  
    34  Multiple containers can use the same volume in the same time period. This is useful if two containers need access to shared data. For example, if one container writes and the other reads the data.
    35  
    36  Volume names must be unique among drivers.  This means you cannot use the same volume name with two different drivers.  If you attempt this `docker` returns an error:
    37  
    38  ```
    39  A volume named  "hello"  already exists with the "some-other" driver. Choose a different volume name.
    40  ```
    41  
    42  If you specify a volume name already in use on the current driver, Docker assumes you want to re-use the existing volume and does not return an error.   
    43  
    44  ## Driver specific options
    45  
    46  Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options:
    47  
    48  ```bash
    49  $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey
    50  ```
    51  
    52  These options are passed directly to the volume driver. Options for
    53  different volume drivers may do different things (or nothing at all).
    54  
    55  The built-in `local` driver on Windows does not support any options.
    56  
    57  The built-in `local` driver on Linux accepts options similar to the linux `mount`
    58  command:
    59  
    60  ```bash
    61  $ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000
    62  ```
    63  
    64  Another example:
    65  
    66  ```bash
    67  $ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2
    68  ```
    69  
    70  
    71  ## Related information
    72  
    73  * [volume inspect](volume_inspect.md)
    74  * [volume ls](volume_ls.md)
    75  * [volume rm](volume_rm.md)
    76  * [Understand Data Volumes](../../userguide/containers/dockervolumes.md)