From b3df92053dd94fb66999010986b62dff335c71d0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 3 Sep 2025 15:39:41 +0200 Subject: [PATCH] add completion for docker image pull With this patch, completion is provided for images already present in the local image cache to help pulling the latest version of the same tag; docker pull go golang:1.12 golang:1.18.0 golang:1.21 golang:1.24 gopher:latest golang:1.13 golang:1.20 golang:1.23 golang:latest docker pull golang: 1.12 1.13 1.18.0 1.20 1.21 1.23 1.24 latest Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 5bf3c6793df77aeb9aaa564ef9f2907ae3ef6aad) Signed-off-by: Sebastiaan van Stijn --- cli/command/image/pull.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/command/image/pull.go b/cli/command/image/pull.go index 668c9cbc8bac..f1d66e2e8261 100644 --- a/cli/command/image/pull.go +++ b/cli/command/image/pull.go @@ -46,7 +46,9 @@ func newPullCommand(dockerCLI command.Cli) *cobra.Command { "category-top": "5", "aliases": "docker image pull, docker pull", }, - ValidArgsFunction: cobra.NoFileCompletions, + // Complete with local images to help pulling the latest version + // of images that are in the image cache. + ValidArgsFunction: completion.ImageNames(dockerCLI, 1), } flags := cmd.Flags()