File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 88"github.com/docker/cli/cli"
99"github.com/docker/cli/cli/command"
1010"github.com/docker/cli/cli/command/completion"
11+ "github.com/docker/docker/api/types"
1112"github.com/docker/docker/api/types/container"
1213"github.com/docker/docker/errdefs"
1314"github.com/pkg/errors"
@@ -38,7 +39,9 @@ func NewRmCommand(dockerCli command.Cli) *cobra.Command {
3839Annotations : map [string ]string {
3940"aliases" : "docker container rm, docker container remove, docker rm" ,
4041},
41- ValidArgsFunction : completion .ContainerNames (dockerCli , true ),
42+ ValidArgsFunction : completion .ContainerNames (dockerCli , true , func (ctr types.Container ) bool {
43+ return opts .force || ctr .State == "exited" || ctr .State == "created"
44+ }),
4245}
4346
4447flags := cmd .Flags ()
You can’t perform that action at this time.
0 commit comments