summaryrefslogtreecommitdiff
path: root/cmd/podman/commit.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-03-15 10:06:49 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-20 16:20:12 +0000
commit38a1b2f16d210525eafcc845e7a9cce598207113 (patch)
tree5616a12d68ebe55138fbde85f936a6bc90d4c8fd /cmd/podman/commit.go
parentecfa321288f10b70a59166f93296c77d262317fc (diff)
downloadpodman-38a1b2f16d210525eafcc845e7a9cce598207113.tar.gz
podman-38a1b2f16d210525eafcc845e7a9cce598207113.tar.bz2
podman-38a1b2f16d210525eafcc845e7a9cce598207113.zip
Image library stage 4 - create and commit
Migrate the podman create and commit subcommandis to leverage the images library. I also had to migrate the cmd/ portions of run and rmi. Signed-off-by: baude <bbaude@redhat.com> Closes: #498 Approved by: mheon
Diffstat (limited to 'cmd/podman/commit.go')
-rw-r--r--cmd/podman/commit.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go
index 59ced293f..34a086004 100644
--- a/cmd/podman/commit.go
+++ b/cmd/podman/commit.go
@@ -2,11 +2,12 @@ package main
import (
"fmt"
+ "io"
"os"
"github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
- "github.com/projectatomic/libpod/libpod"
+ "github.com/projectatomic/libpod/libpod/image"
"github.com/urfave/cli"
)
@@ -58,8 +59,11 @@ func commitCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- var opts libpod.CopyOptions
- var container string
+ var (
+ container string
+ reference string
+ writer io.Writer
+ )
args := c.Args()
switch len(args) {
case 0:
@@ -68,7 +72,7 @@ func commitCmd(c *cli.Context) error {
container = args[0]
case 2:
container = args[0]
- opts.Reference = args[1]
+ reference = args[1]
default:
return errors.Errorf("too many arguments. Usage CONTAINER [REFERENCE]")
}
@@ -90,20 +94,18 @@ func commitCmd(c *cli.Context) error {
History: history,
Author: c.String("author"),
}
- opts.ImageConfig = config
- opts.Writer = nil
if !c.Bool("quiet") {
- opts.Writer = os.Stderr
+ writer = os.Stderr
}
ctr, err := runtime.LookupContainer(container)
if err != nil {
return errors.Wrapf(err, "error looking up container %q", container)
}
- img, err := ctr.Commit(c.BoolT("pause"), opts)
+ newImage, err := ctr.Commit(c.BoolT("pause"), reference, writer, image.SigningOptions{}, config)
if err == nil {
- fmt.Println(img.ID)
+ fmt.Println(newImage.ID())
}
return nil
}