aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/commit.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-25 13:26:52 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-27 20:51:07 +0000
commita824186ac9803ef5f7548df790988a4ebd2d9c07 (patch)
tree63c64e9be4d9c44bd160dd974b740231497eabcd /cmd/podman/commit.go
parent4e468ce83d69e9748e80eb98a6f5bd3c5114cc7d (diff)
downloadpodman-a824186ac9803ef5f7548df790988a4ebd2d9c07.tar.gz
podman-a824186ac9803ef5f7548df790988a4ebd2d9c07.tar.bz2
podman-a824186ac9803ef5f7548df790988a4ebd2d9c07.zip
Use buildah commit and bud in podman
Vendor in buildah and use as much of commit and bug as possible for podman build and commit. Resolves #586 Signed-off-by: baude <bbaude@redhat.com> Closes: #681 Approved by: mheon
Diffstat (limited to 'cmd/podman/commit.go')
-rw-r--r--cmd/podman/commit.go29
1 files changed, 24 insertions, 5 deletions
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go
index c721c8700..14b7ddace 100644
--- a/cmd/podman/commit.go
+++ b/cmd/podman/commit.go
@@ -7,9 +7,9 @@ import (
"strings"
"github.com/pkg/errors"
+ "github.com/projectatomic/buildah"
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
"github.com/projectatomic/libpod/libpod"
- "github.com/projectatomic/libpod/libpod/buildah"
"github.com/projectatomic/libpod/libpod/image"
"github.com/projectatomic/libpod/pkg/util"
"github.com/urfave/cli"
@@ -22,6 +22,11 @@ var (
Usage: "Apply the following possible instructions to the created image (default []): CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR",
},
cli.StringFlag{
+ Name: "format, f",
+ Usage: "`format` of the image manifest and metadata",
+ Value: "oci",
+ },
+ cli.StringFlag{
Name: "message, m",
Usage: "Set commit message for imported image",
},
@@ -63,12 +68,25 @@ func commitCmd(c *cli.Context) error {
defer runtime.Shutdown(false)
var (
- writer io.Writer
+ writer io.Writer
+ mimeType string
)
args := c.Args()
if len(args) != 2 {
return errors.Errorf("you must provide a container name or ID and a target image name")
}
+
+ switch c.String("format") {
+ case "oci":
+ mimeType = buildah.OCIv1ImageManifest
+ if c.IsSet("message") {
+ return errors.Errorf("messages cannot be added to the OCIv1 image format.")
+ }
+ case "docker":
+ mimeType = buildah.Dockerv2ImageManifest
+ default:
+ return errors.Errorf("unrecognized image format %q", c.String("format"))
+ }
container := args[0]
reference := args[1]
if c.IsSet("change") {
@@ -90,9 +108,10 @@ func commitCmd(c *cli.Context) error {
sc := image.GetSystemContext(runtime.GetConfig().SignaturePolicyPath, "", false)
coptions := buildah.CommitOptions{
- SignaturePolicyPath: runtime.GetConfig().SignaturePolicyPath,
- ReportWriter: writer,
- SystemContext: sc,
+ SignaturePolicyPath: runtime.GetConfig().SignaturePolicyPath,
+ ReportWriter: writer,
+ SystemContext: sc,
+ PreferredManifestType: mimeType,
}
options := libpod.ContainerCommitOptions{
CommitOptions: coptions,