cmd.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package volume
  2. import (
  3. "fmt"
  4. "github.com/spf13/cobra"
  5. "github.com/docker/docker/api/client"
  6. "github.com/docker/docker/cli"
  7. )
  8. // NewVolumeCommand returns a cobra command for `volume` subcommands
  9. func NewVolumeCommand(dockerCli *client.DockerCli) *cobra.Command {
  10. cmd := &cobra.Command{
  11. Use: "volume COMMAND",
  12. Short: "Manage Docker volumes",
  13. Long: volumeDescription,
  14. Args: cli.NoArgs,
  15. Run: func(cmd *cobra.Command, args []string) {
  16. fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString())
  17. },
  18. }
  19. cmd.AddCommand(
  20. newCreateCommand(dockerCli),
  21. newInspectCommand(dockerCli),
  22. newListCommand(dockerCli),
  23. newRemoveCommand(dockerCli),
  24. )
  25. return cmd
  26. }
  27. var volumeDescription = `
  28. The **docker volume** command has subcommands for managing data volumes. A data
  29. volume is a specially-designated directory that by-passes storage driver
  30. management.
  31. Data volumes persist data independent of a container's life cycle. When you
  32. delete a container, the Engine daemon does not delete any data volumes. You can
  33. share volumes across multiple containers. Moreover, you can share data volumes
  34. with other computing resources in your system.
  35. To see help for a subcommand, use:
  36. docker volume CMD help
  37. For full details on using docker volume visit Docker's online documentation.
  38. `