From a75a1b3859e6c30f0a24b262bdfc524dcdc07c3b Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Wed, 1 May 2013 15:19:55 -0700 Subject: [PATCH] When no -config is set while committing, use the config of the base image --- commands.go | 3 ++- graph.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 1e624e6825..f4e2a5622b 100644 --- a/commands.go +++ b/commands.go @@ -736,8 +736,9 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri return nil } - config := &Config{} + var config *Config if *flConfig != "" { + config = &Config{} if err := json.Unmarshal([]byte(*flConfig), config); err != nil { return err } diff --git a/graph.go b/graph.go index bf22bb19f0..3823868c83 100644 --- a/graph.go +++ b/graph.go @@ -97,6 +97,11 @@ func (graph *Graph) Create(layerData Archive, container *Container, comment, aut img.Parent = container.Image img.Container = container.Id img.ContainerConfig = *container.Config + if config == nil { + if parentImage, err := graph.Get(container.Image); err == nil && parentImage != nil { + img.Config = parentImage.Config + } + } } if err := graph.Register(layerData, img); err != nil { return nil, err