summaryrefslogtreecommitdiff
path: root/cmd/podmanV2/images
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podmanV2/images')
-rw-r--r--cmd/podmanV2/images/diff.go11
-rw-r--r--cmd/podmanV2/images/history.go16
-rw-r--r--cmd/podmanV2/images/image.go20
-rw-r--r--cmd/podmanV2/images/images.go3
-rw-r--r--cmd/podmanV2/images/import.go11
-rw-r--r--cmd/podmanV2/images/load.go13
-rw-r--r--cmd/podmanV2/images/pull.go40
-rw-r--r--cmd/podmanV2/images/push.go23
-rw-r--r--cmd/podmanV2/images/rm.go9
-rw-r--r--cmd/podmanV2/images/rmi.go3
-rw-r--r--cmd/podmanV2/images/save.go9
-rw-r--r--cmd/podmanV2/images/search.go27
-rw-r--r--cmd/podmanV2/images/tag.go13
-rw-r--r--cmd/podmanV2/images/untag.go2
14 files changed, 68 insertions, 132 deletions
diff --git a/cmd/podmanV2/images/diff.go b/cmd/podmanV2/images/diff.go
index e913a603a..b54cb39a8 100644
--- a/cmd/podmanV2/images/diff.go
+++ b/cmd/podmanV2/images/diff.go
@@ -11,12 +11,11 @@ import (
var (
// podman container _inspect_
diffCmd = &cobra.Command{
- Use: "diff [flags] CONTAINER",
- Args: registry.IdOrLatestArgs,
- Short: "Inspect changes on image's file systems",
- Long: `Displays changes on a image's filesystem. The image will be compared to its parent layer.`,
- PreRunE: preRunE,
- RunE: diff,
+ Use: "diff [flags] CONTAINER",
+ Args: registry.IdOrLatestArgs,
+ Short: "Inspect changes on image's file systems",
+ Long: `Displays changes on a image's filesystem. The image will be compared to its parent layer.`,
+ RunE: diff,
Example: `podman image diff myImage
podman image diff --format json redis:alpine`,
}
diff --git a/cmd/podmanV2/images/history.go b/cmd/podmanV2/images/history.go
index e3bb7a051..d2e880ef7 100644
--- a/cmd/podmanV2/images/history.go
+++ b/cmd/podmanV2/images/history.go
@@ -25,13 +25,12 @@ var (
// podman _history_
historyCmd = &cobra.Command{
- Use: "history [flags] IMAGE",
- Short: "Show history of a specified image",
- Long: long,
- Example: "podman history quay.io/fedora/fedora",
- Args: cobra.ExactArgs(1),
- PersistentPreRunE: preRunE,
- RunE: history,
+ Use: "history [flags] IMAGE",
+ Short: "Show history of a specified image",
+ Long: long,
+ Example: "podman history quay.io/fedora/fedora",
+ Args: cobra.ExactArgs(1),
+ RunE: history,
}
opts = struct {
@@ -48,9 +47,6 @@ func init() {
Command: historyCmd,
})
- historyCmd.SetHelpTemplate(registry.HelpTemplate())
- historyCmd.SetUsageTemplate(registry.UsageTemplate())
-
flags := historyCmd.Flags()
flags.StringVar(&opts.format, "format", "", "Change the output to JSON or a Go template")
flags.BoolVarP(&opts.human, "human", "H", true, "Display sizes and dates in human readable format")
diff --git a/cmd/podmanV2/images/image.go b/cmd/podmanV2/images/image.go
index 9fc7b21d1..7b469bc59 100644
--- a/cmd/podmanV2/images/image.go
+++ b/cmd/podmanV2/images/image.go
@@ -9,12 +9,11 @@ import (
var (
// Command: podman _image_
imageCmd = &cobra.Command{
- Use: "image",
- Short: "Manage images",
- Long: "Manage images",
- TraverseChildren: true,
- PersistentPreRunE: preRunE,
- RunE: registry.SubCommandExists,
+ Use: "image",
+ Short: "Manage images",
+ Long: "Manage images",
+ TraverseChildren: true,
+ RunE: registry.SubCommandExists,
}
)
@@ -23,13 +22,4 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageCmd,
})
- imageCmd.SetHelpTemplate(registry.HelpTemplate())
- imageCmd.SetUsageTemplate(registry.UsageTemplate())
-}
-
-func preRunE(cmd *cobra.Command, args []string) error {
- if _, err := registry.NewImageEngine(cmd, args); err != nil {
- return err
- }
- return nil
}
diff --git a/cmd/podmanV2/images/images.go b/cmd/podmanV2/images/images.go
index d00f0996e..588369a7e 100644
--- a/cmd/podmanV2/images/images.go
+++ b/cmd/podmanV2/images/images.go
@@ -15,7 +15,6 @@ var (
Args: listCmd.Args,
Short: listCmd.Short,
Long: listCmd.Long,
- PreRunE: preRunE,
RunE: listCmd.RunE,
Example: strings.Replace(listCmd.Example, "podman image list", "podman images", -1),
}
@@ -26,8 +25,6 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imagesCmd,
})
- imagesCmd.SetHelpTemplate(registry.HelpTemplate())
- imagesCmd.SetUsageTemplate(registry.UsageTemplate())
imageListFlagSet(imagesCmd.Flags())
}
diff --git a/cmd/podmanV2/images/import.go b/cmd/podmanV2/images/import.go
index 09a15585f..c86db34bf 100644
--- a/cmd/podmanV2/images/import.go
+++ b/cmd/podmanV2/images/import.go
@@ -18,11 +18,10 @@ var (
Note remote tar balls can be specified, via web address.
Optionally tag the image. You can specify the instructions using the --change option.`
importCommand = &cobra.Command{
- Use: "import [flags] PATH [REFERENCE]",
- Short: "Import a tarball to create a filesystem image",
- Long: importDescription,
- RunE: importCon,
- PersistentPreRunE: preRunE,
+ Use: "import [flags] PATH [REFERENCE]",
+ Short: "Import a tarball to create a filesystem image",
+ Long: importDescription,
+ RunE: importCon,
Example: `podman import http://example.com/ctr.tar url-image
cat ctr.tar | podman -q import --message "importing the ctr.tar tarball" - image-imported
cat ctr.tar | podman import -`,
@@ -39,8 +38,6 @@ func init() {
Command: importCommand,
})
- importCommand.SetHelpTemplate(registry.HelpTemplate())
- importCommand.SetUsageTemplate(registry.UsageTemplate())
flags := importCommand.Flags()
flags.StringArrayVarP(&importOpts.Changes, "change", "c", []string{}, "Apply the following possible instructions to the created image (default []): CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR")
flags.StringVarP(&importOpts.Message, "message", "m", "", "Set commit message for imported image")
diff --git a/cmd/podmanV2/images/load.go b/cmd/podmanV2/images/load.go
index 315dbed3a..004daa288 100644
--- a/cmd/podmanV2/images/load.go
+++ b/cmd/podmanV2/images/load.go
@@ -20,12 +20,11 @@ import (
var (
loadDescription = "Loads an image from a locally stored archive (tar file) into container storage."
loadCommand = &cobra.Command{
- Use: "load [flags] [NAME[:TAG]]",
- Short: "Load an image from container archive",
- Long: loadDescription,
- RunE: load,
- Args: cobra.MaximumNArgs(1),
- PersistentPreRunE: preRunE,
+ Use: "load [flags] [NAME[:TAG]]",
+ Short: "Load an image from container archive",
+ Long: loadDescription,
+ RunE: load,
+ Args: cobra.MaximumNArgs(1),
}
)
@@ -39,8 +38,6 @@ func init() {
Command: loadCommand,
})
- loadCommand.SetHelpTemplate(registry.HelpTemplate())
- loadCommand.SetUsageTemplate(registry.UsageTemplate())
flags := loadCommand.Flags()
flags.StringVarP(&loadOpts.Input, "input", "i", "", "Read from specified archive file (default: stdin)")
flags.BoolVarP(&loadOpts.Quiet, "quiet", "q", false, "Suppress the output")
diff --git a/cmd/podmanV2/images/pull.go b/cmd/podmanV2/images/pull.go
index c7e325409..74090dee4 100644
--- a/cmd/podmanV2/images/pull.go
+++ b/cmd/podmanV2/images/pull.go
@@ -7,8 +7,6 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podmanV2/registry"
"github.com/containers/libpod/pkg/domain/entities"
- "github.com/opentracing/opentracing-go"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -28,11 +26,11 @@ var (
// Command: podman pull
pullCmd = &cobra.Command{
- Use: "pull [flags] IMAGE",
- Short: "Pull an image from a registry",
- Long: pullDescription,
- PreRunE: preRunE,
- RunE: imagePull,
+ Use: "pull [flags] IMAGE",
+ Args: cobra.ExactArgs(1),
+ Short: "Pull an image from a registry",
+ Long: pullDescription,
+ RunE: imagePull,
Example: `podman pull imageName
podman pull fedora:latest`,
}
@@ -41,11 +39,10 @@ var (
// It's basically a clone of `pullCmd` with the exception of being a
// child of the images command.
imagesPullCmd = &cobra.Command{
- Use: pullCmd.Use,
- Short: pullCmd.Short,
- Long: pullCmd.Long,
- PreRunE: pullCmd.PreRunE,
- RunE: pullCmd.RunE,
+ Use: pullCmd.Use,
+ Short: pullCmd.Short,
+ Long: pullCmd.Long,
+ RunE: pullCmd.RunE,
Example: `podman image pull imageName
podman image pull fedora:latest`,
}
@@ -58,9 +55,6 @@ func init() {
Command: pullCmd,
})
- pullCmd.SetHelpTemplate(registry.HelpTemplate())
- pullCmd.SetUsageTemplate(registry.UsageTemplate())
-
flags := pullCmd.Flags()
pullFlags(flags)
@@ -71,8 +65,6 @@ func init() {
Parent: imageCmd,
})
- imagesPullCmd.SetHelpTemplate(registry.HelpTemplate())
- imagesPullCmd.SetUsageTemplate(registry.UsageTemplate())
imagesPullFlags := imagesPullCmd.Flags()
pullFlags(imagesPullFlags)
}
@@ -99,20 +91,6 @@ func pullFlags(flags *pflag.FlagSet) {
// imagePull is implement the command for pulling images.
func imagePull(cmd *cobra.Command, args []string) error {
- // Sanity check input.
- if len(args) == 0 {
- return errors.Errorf("an image name must be specified")
- }
- if len(args) > 1 {
- return errors.Errorf("too many arguments. Requires exactly 1")
- }
-
- // Start tracing if requested.
- if cmd.Flags().Changed("trace") {
- span, _ := opentracing.StartSpanFromContext(registry.GetContext(), "pullCmd")
- defer span.Finish()
- }
-
pullOptsAPI := pullOptions.ImagePullOptions
// TLS verification in c/image is controlled via a `types.OptionalBool`
// which allows for distinguishing among set-true, set-false, unspecified
diff --git a/cmd/podmanV2/images/push.go b/cmd/podmanV2/images/push.go
index 82cc0c486..51a60664b 100644
--- a/cmd/podmanV2/images/push.go
+++ b/cmd/podmanV2/images/push.go
@@ -25,11 +25,10 @@ var (
// Command: podman push
pushCmd = &cobra.Command{
- Use: "push [flags] SOURCE DESTINATION",
- Short: "Push an image to a specified destination",
- Long: pushDescription,
- PreRunE: preRunE,
- RunE: imagePush,
+ Use: "push [flags] SOURCE DESTINATION",
+ Short: "Push an image to a specified destination",
+ Long: pushDescription,
+ RunE: imagePush,
Example: `podman push imageID docker://registry.example.com/repository:tag
podman push imageID oci-archive:/path/to/layout:image:tag`,
}
@@ -38,11 +37,10 @@ var (
// It's basically a clone of `pushCmd` with the exception of being a
// child of the images command.
imagePushCmd = &cobra.Command{
- Use: pushCmd.Use,
- Short: pushCmd.Short,
- Long: pushCmd.Long,
- PreRunE: pushCmd.PreRunE,
- RunE: pushCmd.RunE,
+ Use: pushCmd.Use,
+ Short: pushCmd.Short,
+ Long: pushCmd.Long,
+ RunE: pushCmd.RunE,
Example: `podman image push imageID docker://registry.example.com/repository:tag
podman image push imageID oci-archive:/path/to/layout:image:tag`,
}
@@ -55,9 +53,6 @@ func init() {
Command: pushCmd,
})
- pushCmd.SetHelpTemplate(registry.HelpTemplate())
- pushCmd.SetUsageTemplate(registry.UsageTemplate())
-
flags := pushCmd.Flags()
pushFlags(flags)
@@ -68,8 +63,6 @@ func init() {
Parent: imageCmd,
})
- imagePushCmd.SetHelpTemplate(registry.HelpTemplate())
- imagePushCmd.SetUsageTemplate(registry.UsageTemplate())
pushFlags(imagePushCmd.Flags())
}
diff --git a/cmd/podmanV2/images/rm.go b/cmd/podmanV2/images/rm.go
index 6784182d9..f93d6ed50 100644
--- a/cmd/podmanV2/images/rm.go
+++ b/cmd/podmanV2/images/rm.go
@@ -14,11 +14,10 @@ import (
var (
rmDescription = "Removes one or more previously pulled or locally created images."
rmCmd = &cobra.Command{
- Use: "rm [flags] IMAGE [IMAGE...]",
- Short: "Removes one or more images from local storage",
- Long: rmDescription,
- PreRunE: preRunE,
- RunE: rm,
+ Use: "rm [flags] IMAGE [IMAGE...]",
+ Short: "Removes one or more images from local storage",
+ Long: rmDescription,
+ RunE: rm,
Example: `podman image rm imageID
podman image rm --force alpine
podman image rm c4dfb1609ee2 93fd78260bd1 c0ed59d05ff7`,
diff --git a/cmd/podmanV2/images/rmi.go b/cmd/podmanV2/images/rmi.go
index 973763966..ae199b789 100644
--- a/cmd/podmanV2/images/rmi.go
+++ b/cmd/podmanV2/images/rmi.go
@@ -14,7 +14,6 @@ var (
Args: rmCmd.Args,
Short: rmCmd.Short,
Long: rmCmd.Long,
- PreRunE: rmCmd.PreRunE,
RunE: rmCmd.RunE,
Example: strings.Replace(rmCmd.Example, "podman image rm", "podman rmi", -1),
}
@@ -25,7 +24,5 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmiCmd,
})
- rmiCmd.SetHelpTemplate(registry.HelpTemplate())
- rmiCmd.SetUsageTemplate(registry.UsageTemplate())
imageRemoveFlagSet(rmiCmd.Flags())
}
diff --git a/cmd/podmanV2/images/save.go b/cmd/podmanV2/images/save.go
index ae39b7bce..29ee79392 100644
--- a/cmd/podmanV2/images/save.go
+++ b/cmd/podmanV2/images/save.go
@@ -22,11 +22,10 @@ var (
saveDescription = `Save an image to docker-archive or oci-archive on the local machine. Default is docker-archive.`
saveCommand = &cobra.Command{
- Use: "save [flags] IMAGE",
- Short: "Save image to an archive",
- Long: saveDescription,
- PersistentPreRunE: preRunE,
- RunE: save,
+ Use: "save [flags] IMAGE",
+ Short: "Save image to an archive",
+ Long: saveDescription,
+ RunE: save,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.Errorf("need at least 1 argument")
diff --git a/cmd/podmanV2/images/search.go b/cmd/podmanV2/images/search.go
index 2ab9735ec..17c72784c 100644
--- a/cmd/podmanV2/images/search.go
+++ b/cmd/podmanV2/images/search.go
@@ -32,12 +32,14 @@ var (
// Command: podman search
searchCmd = &cobra.Command{
- Use: "search [flags] TERM",
- Short: "Search registry for image",
- Long: searchDescription,
- PreRunE: preRunE,
- RunE: imageSearch,
- Args: cobra.ExactArgs(1),
+ Use: "search [flags] TERM",
+ Short: "Search registry for image",
+ Long: searchDescription,
+ RunE: imageSearch,
+ Args: cobra.ExactArgs(1),
+ Annotations: map[string]string{
+ registry.ParentNSRequired: "",
+ },
Example: `podman search --filter=is-official --limit 3 alpine
podman search registry.fedoraproject.org/ # only works with v2 registries
podman search --format "table {{.Index}} {{.Name}}" registry.fedoraproject.org/fedora`,
@@ -45,12 +47,11 @@ var (
// Command: podman image search
imageSearchCmd = &cobra.Command{
- Use: searchCmd.Use,
- Short: searchCmd.Short,
- Long: searchCmd.Long,
- PreRunE: searchCmd.PreRunE,
- RunE: searchCmd.RunE,
- Args: searchCmd.Args,
+ Use: searchCmd.Use,
+ Short: searchCmd.Short,
+ Long: searchCmd.Long,
+ RunE: searchCmd.RunE,
+ Args: searchCmd.Args,
Example: `podman image search --filter=is-official --limit 3 alpine
podman image search registry.fedoraproject.org/ # only works with v2 registries
podman image search --format "table {{.Index}} {{.Name}}" registry.fedoraproject.org/fedora`,
@@ -64,8 +65,6 @@ func init() {
Command: searchCmd,
})
- searchCmd.SetHelpTemplate(registry.HelpTemplate())
- searchCmd.SetUsageTemplate(registry.UsageTemplate())
flags := searchCmd.Flags()
searchFlags(flags)
diff --git a/cmd/podmanV2/images/tag.go b/cmd/podmanV2/images/tag.go
index f8799d4a7..bf3cf0de6 100644
--- a/cmd/podmanV2/images/tag.go
+++ b/cmd/podmanV2/images/tag.go
@@ -9,12 +9,11 @@ import (
var (
tagDescription = "Adds one or more additional names to locally-stored image."
tagCommand = &cobra.Command{
- Use: "tag [flags] IMAGE TARGET_NAME [TARGET_NAME...]",
- Short: "Add an additional name to a local image",
- Long: tagDescription,
- RunE: tag,
- PreRunE: preRunE,
- Args: cobra.MinimumNArgs(2),
+ Use: "tag [flags] IMAGE TARGET_NAME [TARGET_NAME...]",
+ Short: "Add an additional name to a local image",
+ Long: tagDescription,
+ RunE: tag,
+ Args: cobra.MinimumNArgs(2),
Example: `podman tag 0e3bbc2 fedora:latest
podman tag imageID:latest myNewImage:newTag
podman tag httpd myregistryhost:5000/fedora/httpd:v2`,
@@ -26,8 +25,6 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: tagCommand,
})
- tagCommand.SetHelpTemplate(registry.HelpTemplate())
- tagCommand.SetUsageTemplate(registry.UsageTemplate())
}
func tag(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podmanV2/images/untag.go b/cmd/podmanV2/images/untag.go
index c84827bb3..5eca1cb78 100644
--- a/cmd/podmanV2/images/untag.go
+++ b/cmd/podmanV2/images/untag.go
@@ -24,8 +24,6 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: untagCommand,
})
- untagCommand.SetHelpTemplate(registry.HelpTemplate())
- untagCommand.SetUsageTemplate(registry.UsageTemplate())
}
func untag(cmd *cobra.Command, args []string) error {