github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/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  ```markdown
    14  Usage:  docker volume create [OPTIONS]
    15  
    16  Create a volume
    17  
    18  Options:
    19    -d, --driver string   Specify volume driver name (default "local")
    20        --help            Print usage
    21        --label value     Set metadata for a volume (default [])
    22        --name string     Specify volume name
    23    -o, --opt value       Set driver specific options (default map[])
    24  ```
    25  
    26  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:
    27  
    28  ```bash
    29  $ docker volume create --name hello
    30  hello
    31  
    32  $ docker run -d -v hello:/world busybox ls /world
    33  ```
    34  
    35  The mount is created inside the container's `/world` directory. Docker does not support relative paths for mount points inside the container.
    36  
    37  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.
    38  
    39  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:
    40  
    41  ```
    42  A volume named  "hello"  already exists with the "some-other" driver. Choose a different volume name.
    43  ```
    44  
    45  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.   
    46  
    47  ## Driver specific options
    48  
    49  Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options:
    50  
    51  ```bash
    52  $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey
    53  ```
    54  
    55  These options are passed directly to the volume driver. Options for
    56  different volume drivers may do different things (or nothing at all).
    57  
    58  The built-in `local` driver on Windows does not support any options.
    59  
    60  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).
    61   
    62  For example, the following creates a `tmpfs` volume called `foo` with a size of 100 megabyte and `uid` of 1000.
    63  
    64  ```bash
    65  $ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 --name foo
    66  ```
    67  
    68  Another example that uses `btrfs`:
    69  
    70  ```bash
    71  $ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 --name foo
    72  ```
    73  
    74  Another example that uses `nfs` to mount the `/path/to/dir` in `rw` mode from `192.168.1.1`:
    75  
    76  ```bash
    77  $ docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.1,rw --opt device=:/path/to/dir --name foo
    78  ```
    79  
    80  
    81  ## Related information
    82  
    83  * [volume inspect](volume_inspect.md)
    84  * [volume ls](volume_ls.md)
    85  * [volume rm](volume_rm.md)
    86  * [Understand Data Volumes](../../tutorials/dockervolumes.md)