summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-06 04:30:54 -0400
committerGitHub <noreply@github.com>2021-07-06 04:30:54 -0400
commitba29b30d7432a1c598df7f6dc84999045efc8805 (patch)
treec951d6008becd00ce4ff51ce415aef83e0c59a4f /cmd
parent2681484d7cc416eea6773469884451800c0a07d4 (diff)
parent59abb77fc26bd93d1b8a33ad3baaf159d96a0691 (diff)
downloadpodman-ba29b30d7432a1c598df7f6dc84999045efc8805.tar.gz
podman-ba29b30d7432a1c598df7f6dc84999045efc8805.tar.bz2
podman-ba29b30d7432a1c598df7f6dc84999045efc8805.zip
Merge pull request #10788 from infiniteregrets/multi-pull
support pulling multiple images sequentially in a single podman pull
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/images/pull.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index a831ea848..a4e3515db 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -10,6 +10,7 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
+ "github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/util"
"github.com/pkg/errors"
@@ -32,8 +33,8 @@ var (
// Command: podman pull
pullCmd = &cobra.Command{
- Use: "pull [options] IMAGE",
- Args: cobra.ExactArgs(1),
+ Use: "pull [options] IMAGE [IMAGE...]",
+ Args: cobra.MinimumNArgs(1),
Short: "Pull an image from a registry",
Long: pullDescription,
RunE: imagePull,
@@ -154,17 +155,16 @@ func imagePull(cmd *cobra.Command, args []string) error {
}
// Let's do all the remaining Yoga in the API to prevent us from
// scattering logic across (too) many parts of the code.
- pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), args[0], pullOptions.ImagePullOptions)
- if err != nil {
- return err
- }
-
- if len(pullReport.Images) > 1 {
- fmt.Println("Pulled Images:")
- }
- for _, img := range pullReport.Images {
- fmt.Println(img)
+ var errs utils.OutputErrors
+ for _, arg := range args {
+ pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), arg, pullOptions.ImagePullOptions)
+ if err != nil {
+ errs = append(errs, err)
+ continue
+ }
+ for _, img := range pullReport.Images {
+ fmt.Println(img)
+ }
}
-
- return nil
+ return errs.PrintErrors()
}