From b1bac487a6500b6bf6aabfc2c4e846c12ad1986a Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Thu, 11 Feb 2016 21:48:16 -0500 Subject: [PATCH] Support mount opts for `local` volume driver Allows users to submit options similar to the `mount` command when creating a volume with the `local` volume driver. For example: ```go $ docker volume create -d local --opt type=nfs --opt device=myNfsServer:/data --opt o=noatime,nosuid ``` Signed-off-by: Brian Goff --- docs/reference/commandline/volume_create.md | 30 ++++++++++++++++----- man/docker-volume-create.1.md | 24 ++++++++++------- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/docs/reference/commandline/volume_create.md b/docs/reference/commandline/volume_create.md index 79e794698f..da2c66de80 100644 --- a/docs/reference/commandline/volume_create.md +++ b/docs/reference/commandline/volume_create.md @@ -21,10 +21,12 @@ parent = "smn_cli" 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: - $ docker volume create --name hello - hello +```bash +$ docker volume create --name hello +hello - $ docker run -d -v hello:/world busybox ls /world +$ docker run -d -v hello:/world busybox ls /world +``` The mount is created inside the container's `/world` directory. Docker does not support relative paths for mount points inside the container. @@ -42,16 +44,32 @@ If you specify a volume name already in use on the current driver, Docker assume Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options: - $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey +```bash +$ docker volume create --driver fake --opt tardis=blue --opt timey=wimey +``` These options are passed directly to the volume driver. Options for different volume drivers may do different things (or nothing at all). -*Note*: The built-in `local` volume driver does not currently accept any options. +The built-in `local` driver on Windows does not support any options. + +The built-in `local` driver on Linux accepts options similar to the linux `mount` +command: + +```bash +$ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 +``` + +Another example: + +```bash +$ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 +``` + ## Related information * [volume inspect](volume_inspect.md) * [volume ls](volume_ls.md) * [volume rm](volume_rm.md) -* [Understand Data Volumes](../../userguide/containers/dockervolumes.md) \ No newline at end of file +* [Understand Data Volumes](../../userguide/containers/dockervolumes.md) diff --git a/man/docker-volume-create.1.md b/man/docker-volume-create.1.md index 24b39bc5a2..43338095c7 100644 --- a/man/docker-volume-create.1.md +++ b/man/docker-volume-create.1.md @@ -15,11 +15,9 @@ docker-volume-create - Create a new volume 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: - ``` - $ docker volume create --name hello - hello - $ docker run -d -v hello:/world busybox ls /world - ``` + $ docker volume create --name hello + hello + $ docker run -d -v hello:/world busybox ls /world The mount is created inside the container's `/src` directory. Docker doesn't not support relative paths for mount points inside the container. @@ -29,14 +27,22 @@ Multiple containers can use the same volume in the same time period. This is use Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options: - ``` - $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey - ``` + $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey These options are passed directly to the volume driver. Options for different volume drivers may do different things (or nothing at all). -*Note*: The built-in `local` volume driver does not currently accept any options. +The built-in `local` driver on Windows does not support any options. + +The built-in `local` driver on Linux accepts options similar to the linux `mount` +command: + + $ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 + +Another example: + + $ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 + # OPTIONS **-d**, **--driver**="*local*"