summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cliconfig/config.go1
-rw-r--r--cmd/podman/commit.go7
2 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index 94a7b2091..3428746a9 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -115,6 +115,7 @@ type CommitValues struct {
Pause bool
Quiet bool
IncludeVolumes bool
+ ImageIDFile string
}
type ContainersPrune struct {
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go
index 7c35a4832..3ad3bd275 100644
--- a/cmd/podman/commit.go
+++ b/cmd/podman/commit.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "io/ioutil"
"strings"
"github.com/containers/libpod/cmd/podman/cliconfig"
@@ -41,6 +42,7 @@ func init() {
flags := commitCommand.Flags()
flags.StringArrayVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(ChangeCmds, " | ")))
flags.StringVarP(&commitCommand.Format, "format", "f", "oci", "`Format` of the image manifest and metadata")
+ flags.StringVarP(&commitCommand.ImageIDFile, "iidfile", "", "", "`file` to write the image ID to")
flags.StringVarP(&commitCommand.Message, "message", "m", "", "Set commit message for imported image")
flags.StringVarP(&commitCommand.Author, "author", "a", "", "Set the author for the image committed")
flags.BoolVarP(&commitCommand.Pause, "pause", "p", false, "Pause container during commit")
@@ -70,6 +72,11 @@ func commitCmd(c *cliconfig.CommitValues) error {
if err != nil {
return err
}
+ if c.ImageIDFile != "" {
+ if err = ioutil.WriteFile(c.ImageIDFile, []byte(iid), 0644); err != nil {
+ return errors.Wrapf(err, "failed to write image ID to file %q", c.ImageIDFile)
+ }
+ }
fmt.Println(iid)
return nil
}