Skip to content

Commit a75a1b3

Browse files
committed
When no -config is set while committing, use the config of the base image
1 parent 5c30faf commit a75a1b3

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

commands.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,9 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri
736736
return nil
737737
}
738738

739-
config := &Config{}
739+
var config *Config
740740
if *flConfig != "" {
741+
config = &Config{}
741742
if err := json.Unmarshal([]byte(*flConfig), config); err != nil {
742743
return err
743744
}

graph.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ func (graph *Graph) Create(layerData Archive, container *Container, comment, aut
9797
img.Parent = container.Image
9898
img.Container = container.Id
9999
img.ContainerConfig = *container.Config
100+
if config == nil {
101+
if parentImage, err := graph.Get(container.Image); err == nil && parentImage != nil {
102+
img.Config = parentImage.Config
103+
}
104+
}
100105
}
101106
if err := graph.Register(layerData, img); err != nil {
102107
return nil, err

0 commit comments

Comments
 (0)