diff options
author | Brent Baude <bbaude@redhat.com> | 2020-01-30 09:50:06 -0600 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-01-30 09:51:59 -0600 |
commit | 9bbf08de254dbaad9f12b6ad8a72650994c04fd2 (patch) | |
tree | d9138b9a3c6ae1c3826b50e4dc02fa0e784768a8 /cmd/podman/commit.go | |
parent | ee0b328b7265a017e310e1a9cd83418cf61aa491 (diff) | |
download | podman-9bbf08de254dbaad9f12b6ad8a72650994c04fd2.tar.gz podman-9bbf08de254dbaad9f12b6ad8a72650994c04fd2.tar.bz2 podman-9bbf08de254dbaad9f12b6ad8a72650994c04fd2.zip |
make image reference for commit optional
to match docker compat, the image tag should be optional.
Fixes: #5027
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/commit.go')
-rw-r--r-- | cmd/podman/commit.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index e98b71514..604e8d31c 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -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), "=") |