diff --git a/api.go b/api.go index 3a2aadc33fb9741ce7e7bd850db51bdb17a44263..34a0076218d1da720c8bcf000d9831b32f487946 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 dcd4f44d2f564010b5b78c469410a5b7e702d4c5..4ea44f27051886c546df795a9841e909c9ea8249 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() }