diff --git a/api.go b/api.go index 3a2aadc33f..34a0076218 100644 --- a/api.go +++ b/api.go @@ -602,11 +602,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 dcd4f44d2f..4ea44f2705 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() }