Skip to content

Commit

Permalink
Merge pull request #5028 from baude/commitimage
Browse files Browse the repository at this point in the history
make image reference for commit optional
  • Loading branch information
openshift-merge-robot authored Jan 31, 2020
2 parents 4f96b17 + 9bbf08d commit ba1d130
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions cmd/podman/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ func commitCmd(c *cliconfig.CommitValues) error {
defer runtime.DeferredShutdown(false)

args := c.InputArgs
if len(args) != 2 {
return errors.Errorf("you must provide a container name or ID and a target image name")
if len(args) < 1 {
return errors.Errorf("you must provide a container name or ID and optionally a target image name")
}

container := args[0]
reference := args[1]
reference := ""
if len(args) > 1 {
reference = args[1]
}
if c.Flag("change").Changed {
for _, change := range c.Change {
splitChange := strings.Split(strings.ToUpper(change), "=")
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-commit.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ podman\-commit - Create new image based on the changed container
## SYNOPSIS
**podman commit** [*options*] *container* *image*

**podman container commit** [*options*] *container* *image*
**podman container commit** [*options*] *container* [*image*]

## DESCRIPTION
**podman commit** creates an image based on a changed container. The author of the
Expand Down

0 comments on commit ba1d130

Please sign in to comment.