From f482432a76a898e5d0252b6c5878a0e60290d0a4 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 10 Sep 2013 22:13:15 +0000 Subject: [PATCH] improved hostConfig reload --- api.go | 4 ++-- container.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api.go b/api.go index f4a96a030..a1d0c7aa9 100644 --- a/api.go +++ b/api.go @@ -654,11 +654,11 @@ func deleteImages(srv *Server, version float64, w http.ResponseWriter, r *http.R } func postContainersStart(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - hostConfig := &HostConfig{} - + var hostConfig *HostConfig // allow a nil body for backwards compatibility if r.Body != nil { if matchesContentType(r.Header.Get("Content-Type"), "application/json") { + hostConfig = &HostConfig{} if err := json.NewDecoder(r.Body).Decode(hostConfig); err != nil { return err } diff --git a/container.go b/container.go index 5ddb07562..ea7e6cc90 100644 --- a/container.go +++ b/container.go @@ -564,7 +564,7 @@ func (container *Container) Start(hostConfig *HostConfig) error { container.State.Lock() defer container.State.Unlock() - if len(hostConfig.Binds) == 0 && len(hostConfig.LxcConf) == 0 { + if hostConfig == nil { // in docker start of docker restart we want to reuse previous HostConfigFile hostConfig, _ = container.ReadHostConfig() }