mirror of
https://github.com/docker/docs.git
synced 2026-03-27 22:38:54 +07:00
'docker commit -m': optional commit message
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user