mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
58738cdee3
This fix is a follow up for comment https://github.com/docker/docker/pull/28535#issuecomment-263215225 This fix provides `--filter until=<timestamp>` for `docker container/image prune`. This fix adds `--filter until=<timestamp>` to `docker container/image prune` so that it is possible to specify a timestamp and prune those containers/images that are earlier than the timestamp. Related docs has been updated Several integration tests have been added to cover changes. This fix fixes #28497. This fix is related to #28535. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
51 lines
1.8 KiB
Go
51 lines
1.8 KiB
Go
package prune
|
|
|
|
import (
|
|
"github.com/docker/docker/cli/command"
|
|
"github.com/docker/docker/cli/command/container"
|
|
"github.com/docker/docker/cli/command/image"
|
|
"github.com/docker/docker/cli/command/network"
|
|
"github.com/docker/docker/cli/command/volume"
|
|
"github.com/docker/docker/opts"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// NewContainerPruneCommand returns a cobra prune command for containers
|
|
func NewContainerPruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
return container.NewPruneCommand(dockerCli)
|
|
}
|
|
|
|
// NewVolumePruneCommand returns a cobra prune command for volumes
|
|
func NewVolumePruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
return volume.NewPruneCommand(dockerCli)
|
|
}
|
|
|
|
// NewImagePruneCommand returns a cobra prune command for images
|
|
func NewImagePruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
return image.NewPruneCommand(dockerCli)
|
|
}
|
|
|
|
// NewNetworkPruneCommand returns a cobra prune command for Networks
|
|
func NewNetworkPruneCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
return network.NewPruneCommand(dockerCli)
|
|
}
|
|
|
|
// RunContainerPrune executes a prune command for containers
|
|
func RunContainerPrune(dockerCli *command.DockerCli, filter opts.FilterOpt) (uint64, string, error) {
|
|
return container.RunPrune(dockerCli, filter)
|
|
}
|
|
|
|
// RunVolumePrune executes a prune command for volumes
|
|
func RunVolumePrune(dockerCli *command.DockerCli, filter opts.FilterOpt) (uint64, string, error) {
|
|
return volume.RunPrune(dockerCli)
|
|
}
|
|
|
|
// RunImagePrune executes a prune command for images
|
|
func RunImagePrune(dockerCli *command.DockerCli, all bool, filter opts.FilterOpt) (uint64, string, error) {
|
|
return image.RunPrune(dockerCli, all, filter)
|
|
}
|
|
|
|
// RunNetworkPrune executes a prune command for networks
|
|
func RunNetworkPrune(dockerCli *command.DockerCli, filter opts.FilterOpt) (uint64, string, error) {
|
|
return network.RunPrune(dockerCli, filter)
|
|
}
|