cmd.go 1.3 KB

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