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:
parent
5c30faf6f7
commit
a75a1b3859
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
5
graph.go
5
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
|
||||
|
|
Loading…
Add table
Reference in a new issue