github.com/olljanat/moby@v1.13.1/docs/reference/commandline/volume_create.md (about)

     1  ---
     2  title: "volume create"
     3  description: "The volume create command description and usage"
     4  keywords: "volume, create"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # volume create
    17  
    18  ```markdown
    19  Usage:  docker volume create [OPTIONS] [VOLUME]
    20  
    21  Create a volume
    22  
    23  Options:
    24    -d, --driver string   Specify volume driver name (default "local")
    25        --help            Print usage
    26        --label value     Set metadata for a volume (default [])
    27    -o, --opt value       Set driver specific options (default map[])
    28  ```
    29  
    30  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:
    31  
    32  ```bash
    33  $ docker volume create hello
    34  hello
    35  
    36  $ docker run -d -v hello:/world busybox ls /world
    37  ```
    38  
    39  The mount is created inside the container's `/world` directory. Docker does not support relative paths for mount points inside the container.
    40  
    41  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.
    42  
    43  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:
    44  
    45  ```
    46  A volume named  "hello"  already exists with the "some-other" driver. Choose a different volume name.
    47  ```
    48  
    49  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.   
    50  
    51  ## Driver specific options
    52  
    53  Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options:
    54  
    55  ```bash
    56  $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey
    57  ```
    58  
    59  These options are passed directly to the volume driver. Options for
    60  different volume drivers may do different things (or nothing at all).
    61  
    62  The built-in `local` driver on Windows does not support any options.
    63  
    64  The built-in `local` driver on Linux accepts options similar to the linux `mount` command. You can provide multiple options by passing the `--opt` flag multiple times. Some `mount` options (such as the `o` option) can take a comma-separated list of options. Complete list of available mount options can be found [here](http://man7.org/linux/man-pages/man8/mount.8.html).
    65  
    66  For example, the following creates a `tmpfs` volume called `foo` with a size of 100 megabyte and `uid` of 1000.
    67  
    68  ```bash
    69  $ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 foo
    70  ```
    71  
    72  Another example that uses `btrfs`:
    73  
    74  ```bash
    75  $ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 foo
    76  ```
    77  
    78  Another example that uses `nfs` to mount the `/path/to/dir` in `rw` mode from `192.168.1.1`:
    79  
    80  ```bash
    81  $ docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.1,rw --opt device=:/path/to/dir foo
    82  ```
    83  
    84  
    85  ## Related information
    86  
    87  * [volume inspect](volume_inspect.md)
    88  * [volume ls](volume_ls.md)
    89  * [volume rm](volume_rm.md)
    90  * [volume prune](volume_prune.md)
    91  * [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)