-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Description
docker container remove does not exist while docker (volume|network) remove exist
Details
cli/cli/command/container/rm.go
Lines 29 to 41 in 5f9c58f
| cmd := &cobra.Command{ | |
| Use: "rm [OPTIONS] CONTAINER [CONTAINER...]", | |
| Short: "Remove one or more containers", | |
| Args: cli.RequiresMinArgs(1), | |
| RunE: func(cmd *cobra.Command, args []string) error { | |
| opts.containers = args | |
| return runRm(dockerCli, &opts) | |
| }, | |
| Annotations: map[string]string{ | |
| "aliases": "docker container rm, docker rm", | |
| }, | |
| ValidArgsFunction: completion.ContainerNames(dockerCli, true), | |
| } |
cli/cli/command/image/remove.go
Lines 21 to 50 in 5f9c58f
| // NewRemoveCommand creates a new `docker remove` command | |
| func NewRemoveCommand(dockerCli command.Cli) *cobra.Command { | |
| var opts removeOptions | |
| cmd := &cobra.Command{ | |
| Use: "rmi [OPTIONS] IMAGE [IMAGE...]", | |
| Short: "Remove one or more images", | |
| Args: cli.RequiresMinArgs(1), | |
| RunE: func(cmd *cobra.Command, args []string) error { | |
| return runRemove(dockerCli, opts, args) | |
| }, | |
| Annotations: map[string]string{ | |
| "aliases": "docker image rm, docker image remove, docker rmi", | |
| }, | |
| } | |
| flags := cmd.Flags() | |
| flags.BoolVarP(&opts.force, "force", "f", false, "Force removal of the image") | |
| flags.BoolVar(&opts.noPrune, "no-prune", false, "Do not delete untagged parents") | |
| return cmd | |
| } | |
| func newRemoveCommand(dockerCli command.Cli) *cobra.Command { | |
| cmd := *NewRemoveCommand(dockerCli) | |
| cmd.Aliases = []string{"rmi", "remove"} | |
| cmd.Use = "rm [OPTIONS] IMAGE [IMAGE...]" | |
| return &cmd | |
| } |
cli/cli/command/volume/remove.go
Lines 24 to 36 in 5f9c58f
| cmd := &cobra.Command{ | |
| Use: "rm [OPTIONS] VOLUME [VOLUME...]", | |
| Aliases: []string{"remove"}, | |
| Short: "Remove one or more volumes", | |
| Long: removeDescription, | |
| Example: removeExample, | |
| Args: cli.RequiresMinArgs(1), | |
| RunE: func(cmd *cobra.Command, args []string) error { | |
| opts.volumes = args | |
| return runRemove(dockerCli, &opts) | |
| }, | |
| ValidArgsFunction: completion.VolumeNames(dockerCli), | |
| } |
cli/cli/command/network/remove.go
Lines 22 to 31 in 5f9c58f
| cmd := &cobra.Command{ | |
| Use: "rm NETWORK [NETWORK...]", | |
| Aliases: []string{"remove"}, | |
| Short: "Remove one or more networks", | |
| Args: cli.RequiresMinArgs(1), | |
| RunE: func(cmd *cobra.Command, args []string) error { | |
| return runRemove(dockerCli, args, &opts) | |
| }, | |
| ValidArgsFunction: completion.NetworkNames(dockerCli), | |
| } |
Reproduce
docker container remove
Expected behavior
docker container remove exists as an alias for docker container rm
docker version
master (5f9c58ffa099af148e0285926aa9be5acd25ae77)docker info
UnneededAdditional Info
No response