From 5bf3c6793df77aeb9aaa564ef9f2907ae3ef6aad 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 --- 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 57655cf20..136fa14f4 100644 --- a/cli/command/image/pull.go +++ b/cli/command/image/pull.go @@ -38,7 +38,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), DisableFlagsInUseLine: true, }