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