mirror of https://github.com/docker/docs.git
'docker commit -m': optional commit message
This commit is contained in:
parent
f7eaaa3adb
commit
0d46ddf7b4
|
@ -630,6 +630,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri
|
||||||
cmd := rcli.Subcmd(stdout,
|
cmd := rcli.Subcmd(stdout,
|
||||||
"commit", "[OPTIONS] CONTAINER [REPOSITORY [TAG]]",
|
"commit", "[OPTIONS] CONTAINER [REPOSITORY [TAG]]",
|
||||||
"Create a new image from a container's changes")
|
"Create a new image from a container's changes")
|
||||||
|
fl_comment := cmd.String("m", "", "Commit message")
|
||||||
if err := cmd.Parse(args); err != nil {
|
if err := cmd.Parse(args); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -638,7 +639,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri
|
||||||
cmd.Usage()
|
cmd.Usage()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
img, err := srv.runtime.Commit(containerName, repository, tag)
|
img, err := srv.runtime.Commit(containerName, repository, tag, *fl_comment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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.
|
// Commit creates a new filesystem image from the current state of a container.
|
||||||
// The image can optionally be tagged into a repository
|
// 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)
|
container := runtime.Get(id)
|
||||||
if container == nil {
|
if container == nil {
|
||||||
return nil, fmt.Errorf("No such container: %s", id)
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
// Create a new image from the container's base layers + a new layer from container changes
|
// 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue