Set Long text for volume commands so they can be used to generate man pages.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-06-20 16:33:53 -04:00
parent 00a8a40398
commit 25e9b06ac0
10 changed files with 81 additions and 205 deletions

View File

@ -12,8 +12,9 @@ import (
// NewVolumeCommand returns a cobra command for `volume` subcommands
func NewVolumeCommand(dockerCli *client.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "volume",
Use: "volume COMMAND",
Short: "Manage Docker volumes",
Long: volumeDescription,
Args: cli.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString())
@ -27,3 +28,21 @@ func NewVolumeCommand(dockerCli *client.DockerCli) *cobra.Command {
)
return cmd
}
var volumeDescription = `
The **docker volume** command has subcommands for managing data volumes. A data
volume is a specially-designated directory that by-passes storage driver
management.
Data volumes persist data independent of a container's life cycle. When you
delete a container, the Engine daemon does not delete any data volumes. You can
share volumes across multiple containers. Moreover, you can share data volumes
with other computing resources in your system.
To see help for a subcommand, use:
docker volume CMD help
For full details on using docker volume visit Docker's online documentation.
`

View File

@ -28,6 +28,7 @@ func newCreateCommand(dockerCli *client.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "create [OPTIONS]",
Short: "Create a volume",
Long: createDescription,
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runCreate(dockerCli, opts)
@ -60,3 +61,34 @@ func runCreate(dockerCli *client.DockerCli, opts createOptions) error {
fmt.Fprintf(dockerCli.Out(), "%s\n", vol.Name)
return nil
}
var createDescription = `
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
The mount is created inside the container's **/src** directory. Docker doesn't not support relative paths for mount points inside the container.
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.
## Driver specific options
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
These options are passed directly to the volume driver. Options for different volume drivers may do different things (or nothing at all).
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
`

View File

@ -20,6 +20,7 @@ func newInspectCommand(dockerCli *client.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "inspect [OPTIONS] VOLUME [VOLUME...]",
Short: "Display detailed information on one or more volumes",
Long: inspectDescription,
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.names = args
@ -44,3 +45,11 @@ func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error {
return inspect.Inspect(dockerCli.Out(), opts.names, opts.format, getVolFunc)
}
var inspectDescription = `
Returns information about one or more volumes. By default, this command renders
all results in a JSON array. You can specify an alternate format to execute a
given template is executed for each result. Go's http://golang.org/pkg/text/template/
package describes all the details of the format.
`

View File

@ -34,6 +34,7 @@ func newListCommand(dockerCli *client.DockerCli) *cobra.Command {
Use: "ls [OPTIONS]",
Aliases: []string{"list"},
Short: "List volumes",
Long: listDescription,
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runList(dockerCli, opts)
@ -84,3 +85,11 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
w.Flush()
return nil
}
var listDescription = `
Lists all the volumes Docker knows about. You can filter using the **-f** or **--filter** flag. The filtering format is a **key=value** pair. To specify more than one filter, pass multiple flags (for example, **--filter "foo=bar" --filter "bif=baz"**)
There is a single supported filter **dangling=value** which takes a boolean of **true** or **false**.
`

View File

@ -15,6 +15,8 @@ func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command {
Use: "rm VOLUME [VOLUME]...",
Aliases: []string{"remove"},
Short: "Remove a volume",
Long: removeDescription,
Example: removeExample,
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runRemove(dockerCli, args)
@ -41,3 +43,12 @@ func runRemove(dockerCli *client.DockerCli, volumes []string) error {
}
return nil
}
var removeDescription = `
Removes one or more volumes. You cannot remove a volume that is in use by a container.
`
var removeExample = `
$ docker volume rm hello
hello
`

View File

@ -1,65 +0,0 @@
% DOCKER(1) Docker User Manuals
% Docker Community
% JULY 2015
# NAME
docker-volume-create - Create a new volume
# SYNOPSIS
**docker volume create**
[**-d**|**--driver**[=*DRIVER*]]
[**--help**]
[**--label**[=*[]*]]
[**--name**[=*NAME*]]
[**-o**|**--opt**[=*[]*]]
# DESCRIPTION
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
The mount is created inside the container's `/src` directory. Docker doesn't not support relative paths for mount points inside the container.
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.
## Driver specific options
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
These options are passed directly to the volume driver. Options for
different volume drivers may do different things (or nothing at all).
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*"
Specify volume driver name
**--help**
Print usage statement
**--label**=*label*
Set metadata for a volume
**--name**=""
Specify volume name
**-o**, **--opt**=[]
Set driver specific options
# HISTORY
July 2015, created by Brian Goff <cpuguy83@gmail.com>

View File

@ -1,29 +0,0 @@
% DOCKER(1) Docker User Manuals
% Docker Community
% JULY 2015
# NAME
docker-volume-inspect - Get low-level information about a volume
# SYNOPSIS
**docker volume inspect**
[**-f**|**--format**[=*FORMAT*]]
[**--help**]
VOLUME [VOLUME...]
# DESCRIPTION
Returns information about one or more volumes. By default, this command renders all results
in a JSON array. You can specify an alternate format to execute a given template
is executed for each result. Go's
http://golang.org/pkg/text/template/ package describes all the details of the
format.
# OPTIONS
**-f**, **--format**=""
Format the output using the given go template.
**--help**
Print usage statement
# HISTORY
July 2015, created by Brian Goff <cpuguy83@gmail.com>

View File

@ -1,33 +0,0 @@
% DOCKER(1) Docker User Manuals
% Docker Community
% JULY 2015
# NAME
docker-volume-ls - List all volumes
# SYNOPSIS
**docker volume ls**
[**-f**|**--filter**[=*FILTER*]]
[**--help**]
[**-q**|**--quiet**[=*true*|*false*]]
# DESCRIPTION
Lists all the volumes Docker knows about. You can filter using the `-f` or `--filter` flag. The filtering format is a `key=value` pair. To specify more than one filter, pass multiple flags (for example, `--filter "foo=bar" --filter "bif=baz"`)
There is a single supported filter `dangling=value` which takes a boolean of `true` or `false`.
# OPTIONS
**-f**, **--filter**=""
Filter output based on these conditions:
- dangling=<boolean> a volume if referenced or not
- driver=<string> a volume's driver name
- name=<string> a volume's name
**--help**
Print usage statement
**-q**, **--quiet**=*true*|*false*
Only display volume names
# HISTORY
July 2015, created by Brian Goff <cpuguy83@gmail.com>

View File

@ -1,26 +0,0 @@
% DOCKER(1) Docker User Manuals
% Docker Community
% JULY 2015
# NAME
docker-volume-rm - Remove a volume
# SYNOPSIS
**docker volume rm**
[**--help**]
VOLUME [VOLUME...]
# DESCRIPTION
Removes one or more volumes. You cannot remove a volume that is in use by a container.
```
$ docker volume rm hello
hello
```
# OPTIONS
**--help**
Print usage statement
# HISTORY
July 2015, created by Brian Goff <cpuguy83@gmail.com>

View File

@ -1,51 +0,0 @@
% DOCKER(1) Docker User Manuals
% Docker Community
% Feb 2016
# NAME
docker-volume - Create a new volume
# SYNOPSIS
**docker volume** [OPTIONS] COMMAND
[**--help**]
# DESCRIPTION
docker volume has subcommands for managing data volumes.
## Data volumes
The `docker volume` command has subcommands for managing data volumes. A data volume is a specially-designated directory that by-passes storage driver management.
Data volumes persist data independent of a container's life cycle. When you delete a container, the Engine daemon does not delete any data volumes. You can share volumes across multiple containers. Moreover, you can share data volumes with other computing resources in your system.
To see help for a subcommand, use:
```
docker volume CMD help
```
For full details on using docker volume visit Docker's online documentation.
# OPTIONS
**--help**
Print usage statement
# COMMANDS
**create**
Create a volume
See **docker-volume-create(1)** for full documentation on the **create** command.
**inspect**
Display detailed information on one or more volumes
See **docker-volume-inspect(1)** for full documentation on the **inspect** command.
**ls**
List volumes
See **docker-volume-ls(1)** for full documentation on the **ls** command.
**rm**
Remove a volume
See **docker-volume-rm(1)** for full documentation on the **rm** command.
# HISTORY
Feb 2016, created by Dan Walsh <dwalsh@redhat.com>