Skip to content

Commit

Permalink
preserve container config when committing
Browse files Browse the repository at this point in the history
Fixes GitHub issue moby#1141
moby#1141
  • Loading branch information
cap10morgan committed Feb 1, 2014
1 parent a446b34 commit db74a8b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1030,12 +1030,16 @@ func (srv *Server) ContainerCommit(job *engine.Job) engine.Status {
if container == nil {
return job.Errorf("No such container: %s", name)
}
var config Config
if err := job.GetenvJson("config", &config); err != nil {
var config = container.Config
var newConfig Config
if err := job.GetenvJson("config", &newConfig); err != nil {
return job.Error(err)
}
if newConfig != (Config{}) { // doesn't work; can't compare slices for equality
config = &newConfig
}

img, err := srv.runtime.Commit(container, job.Getenv("repo"), job.Getenv("tag"), job.Getenv("comment"), job.Getenv("author"), &config)
img, err := srv.runtime.Commit(container, job.Getenv("repo"), job.Getenv("tag"), job.Getenv("comment"), job.Getenv("author"), config)
if err != nil {
return job.Error(err)
}
Expand Down

0 comments on commit db74a8b

Please sign in to comment.