mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1849 from dotcloud/better_handle_hostConfig
Improved hostConfig reload
This commit is contained in:
commit
45b50730e3
2 changed files with 3 additions and 3 deletions
4
api.go
4
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 {
|
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
|
// allow a nil body for backwards compatibility
|
||||||
if r.Body != nil {
|
if r.Body != nil {
|
||||||
if matchesContentType(r.Header.Get("Content-Type"), "application/json") {
|
if matchesContentType(r.Header.Get("Content-Type"), "application/json") {
|
||||||
|
hostConfig = &HostConfig{}
|
||||||
if err := json.NewDecoder(r.Body).Decode(hostConfig); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(hostConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,7 +564,7 @@ func (container *Container) Start(hostConfig *HostConfig) error {
|
||||||
container.State.Lock()
|
container.State.Lock()
|
||||||
defer container.State.Unlock()
|
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()
|
hostConfig, _ = container.ReadHostConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue