mirror of https://github.com/docker/cli.git
better prune and system df
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
0c6d66b89a
commit
871b692833
|
@ -67,7 +67,7 @@ func runPrune(dockerCli *command.DockerCli, opts pruneOptions) (spaceReclaimed u
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunPrune call the Container Prune API
|
// RunPrune calls the Container Prune API
|
||||||
// This returns the amount of space reclaimed and a detailed output string
|
// This returns the amount of space reclaimed and a detailed output string
|
||||||
func RunPrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
func RunPrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
||||||
return runPrune(dockerCli, pruneOptions{force: true})
|
return runPrune(dockerCli, pruneOptions{force: true})
|
||||||
|
|
|
@ -83,7 +83,7 @@ func runPrune(dockerCli *command.DockerCli, opts pruneOptions) (spaceReclaimed u
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunPrune call the Image Prune API
|
// RunPrune calls the Image Prune API
|
||||||
// This returns the amount of space reclaimed and a detailed output string
|
// This returns the amount of space reclaimed and a detailed output string
|
||||||
func RunPrune(dockerCli *command.DockerCli, all bool) (uint64, string, error) {
|
func RunPrune(dockerCli *command.DockerCli, all bool) (uint64, string, error) {
|
||||||
return runPrune(dockerCli, pruneOptions{force: true, all: all})
|
return runPrune(dockerCli, pruneOptions{force: true, all: all})
|
||||||
|
|
|
@ -8,32 +8,32 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewContainerPruneCommand return a cobra prune command for containers
|
// NewContainerPruneCommand returns a cobra prune command for containers
|
||||||
func NewContainerPruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewContainerPruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return container.NewPruneCommand(dockerCli)
|
return container.NewPruneCommand(dockerCli)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVolumePruneCommand return a cobra prune command for volumes
|
// NewVolumePruneCommand returns a cobra prune command for volumes
|
||||||
func NewVolumePruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewVolumePruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return volume.NewPruneCommand(dockerCli)
|
return volume.NewPruneCommand(dockerCli)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImagePruneCommand return a cobra prune command for images
|
// NewImagePruneCommand returns a cobra prune command for images
|
||||||
func NewImagePruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewImagePruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return image.NewPruneCommand(dockerCli)
|
return image.NewPruneCommand(dockerCli)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunContainerPrune execute a prune command for containers
|
// RunContainerPrune executes a prune command for containers
|
||||||
func RunContainerPrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
func RunContainerPrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
||||||
return container.RunPrune(dockerCli)
|
return container.RunPrune(dockerCli)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunVolumePrune execute a prune command for volumes
|
// RunVolumePrune executes a prune command for volumes
|
||||||
func RunVolumePrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
func RunVolumePrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
||||||
return volume.RunPrune(dockerCli)
|
return volume.RunPrune(dockerCli)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunImagePrune execute a prune command for images
|
// RunImagePrune executes a prune command for images
|
||||||
func RunImagePrune(dockerCli *command.DockerCli, all bool) (uint64, string, error) {
|
func RunImagePrune(dockerCli *command.DockerCli, all bool) (uint64, string, error) {
|
||||||
return image.RunPrune(dockerCli, all)
|
return image.RunPrune(dockerCli, all)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ func NewDiskUsageCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "df [OPTIONS]",
|
Use: "df [OPTIONS]",
|
||||||
Short: "Show docker disk usage",
|
Short: "Show docker disk usage",
|
||||||
Args: cli.RequiresMaxArgs(1),
|
Args: cli.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return runDiskUsage(dockerCli, opts)
|
return runDiskUsage(dockerCli, opts)
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,13 +15,13 @@ type pruneOptions struct {
|
||||||
all bool
|
all bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPruneCommand creates a new cobra.Command for `docker du`
|
// NewPruneCommand creates a new cobra.Command for `docker prune`
|
||||||
func NewPruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewPruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
var opts pruneOptions
|
var opts pruneOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "prune [OPTIONS]",
|
Use: "prune [OPTIONS]",
|
||||||
Short: "Remove unused data.",
|
Short: "Remove unused data",
|
||||||
Args: cli.NoArgs,
|
Args: cli.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return runPrune(dockerCli, opts)
|
return runPrune(dockerCli, opts)
|
||||||
|
|
|
@ -67,7 +67,7 @@ func runPrune(dockerCli *command.DockerCli, opts pruneOptions) (spaceReclaimed u
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunPrune call the Volume Prune API
|
// RunPrune calls the Volume Prune API
|
||||||
// This returns the amount of space reclaimed and a detailed output string
|
// This returns the amount of space reclaimed and a detailed output string
|
||||||
func RunPrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
func RunPrune(dockerCli *command.DockerCli) (uint64, string, error) {
|
||||||
return runPrune(dockerCli, pruneOptions{force: true})
|
return runPrune(dockerCli, pruneOptions{force: true})
|
||||||
|
|
Loading…
Reference in New Issue