1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

When no -config is set while committing, use the config of the base image

This commit is contained in:
Guillaume J. Charmes 2013-05-01 15:19:55 -07:00
parent 5c30faf6f7
commit a75a1b3859
2 changed files with 7 additions and 1 deletions

View file

@ -736,8 +736,9 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri
return nil return nil
} }
config := &Config{} var config *Config
if *flConfig != "" { if *flConfig != "" {
config = &Config{}
if err := json.Unmarshal([]byte(*flConfig), config); err != nil { if err := json.Unmarshal([]byte(*flConfig), config); err != nil {
return err return err
} }

View file

@ -97,6 +97,11 @@ func (graph *Graph) Create(layerData Archive, container *Container, comment, aut
img.Parent = container.Image img.Parent = container.Image
img.Container = container.Id img.Container = container.Id
img.ContainerConfig = *container.Config 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 { if err := graph.Register(layerData, img); err != nil {
return nil, err return nil, err