From 0d46ddf7b4940f7e9b1cecf00a9f608134cdbac8 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Sat, 23 Mar 2013 19:16:42 -0700 Subject: [PATCH] 'docker commit -m': optional commit message --- commands.go | 3 ++- runtime.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index 80bb5d00d6..0de3c77c39 100644 --- a/commands.go +++ b/commands.go @@ -630,6 +630,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri cmd := rcli.Subcmd(stdout, "commit", "[OPTIONS] CONTAINER [REPOSITORY [TAG]]", "Create a new image from a container's changes") + fl_comment := cmd.String("m", "", "Commit message") if err := cmd.Parse(args); err != nil { return nil } @@ -638,7 +639,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri cmd.Usage() return nil } - img, err := srv.runtime.Commit(containerName, repository, tag) + img, err := srv.runtime.Commit(containerName, repository, tag, *fl_comment) if err != nil { return err } diff --git a/runtime.go b/runtime.go index b7f2582b46..4c11cc9c99 100644 --- a/runtime.go +++ b/runtime.go @@ -181,7 +181,7 @@ func (runtime *Runtime) Destroy(container *Container) error { // Commit creates a new filesystem image from the current state of a container. // The image can optionally be tagged into a repository -func (runtime *Runtime) Commit(id, repository, tag string) (*Image, error) { +func (runtime *Runtime) Commit(id, repository, tag, comment string) (*Image, error) { container := runtime.Get(id) if container == nil { return nil, fmt.Errorf("No such container: %s", id) @@ -193,7 +193,7 @@ func (runtime *Runtime) Commit(id, repository, tag string) (*Image, error) { return nil, err } // Create a new image from the container's base layers + a new layer from container changes - img, err := runtime.graph.Create(rwTar, container, "") + img, err := runtime.graph.Create(rwTar, container, comment) if err != nil { return nil, err }