summaryrefslogtreecommitdiff
path: root/cmd/podman/manifest/remove.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-07 19:10:32 +0200
committerGitHub <noreply@github.com>2020-05-07 19:10:32 +0200
commit1d3cdf9a4642df073becb54d178d6b1959526a47 (patch)
tree8648b5f2e821b25b7c2211d1389554666579e42c /cmd/podman/manifest/remove.go
parent0799e52d15c6d63434ea685095d4c20c20d034f3 (diff)
parent5621f5199d0aeaefae77db920866d7aeea9d1e7b (diff)
downloadpodman-1d3cdf9a4642df073becb54d178d6b1959526a47.tar.gz
podman-1d3cdf9a4642df073becb54d178d6b1959526a47.tar.bz2
podman-1d3cdf9a4642df073becb54d178d6b1959526a47.zip
Merge pull request #5961 from QiWang19/manifest-remove-push
Manifest remove, push
Diffstat (limited to 'cmd/podman/manifest/remove.go')
-rw-r--r--cmd/podman/manifest/remove.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/cmd/podman/manifest/remove.go b/cmd/podman/manifest/remove.go
new file mode 100644
index 000000000..4d345efc0
--- /dev/null
+++ b/cmd/podman/manifest/remove.go
@@ -0,0 +1,47 @@
+package manifest
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/containers/libpod/cmd/podman/registry"
+ "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+)
+
+var (
+ removeCmd = &cobra.Command{
+ Use: "remove [flags] LIST IMAGE",
+ Short: "Remove an entry from a manifest list or image index",
+ Long: "Removes an image from a manifest list or image index.",
+ RunE: remove,
+ Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
+ Args: cobra.ExactArgs(2),
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: removeCmd,
+ Parent: manifestCmd,
+ })
+}
+
+func remove(cmd *cobra.Command, args []string) error {
+ listImageSpec := args[0]
+ instanceSpec := args[1]
+ if listImageSpec == "" {
+ return errors.Errorf(`invalid image name "%s"`, listImageSpec)
+ }
+ if instanceSpec == "" {
+ return errors.Errorf(`invalid image digest "%s"`, instanceSpec)
+ }
+ updatedListID, err := registry.ImageEngine().ManifestRemove(context.Background(), args)
+ if err != nil {
+ return errors.Wrapf(err, "error removing from manifest list %s", listImageSpec)
+ }
+ fmt.Printf("%s\n", updatedListID)
+ return nil
+}