mirror of https://github.com/docker/docs.git
Merge pull request #54 from shykes/vieux_merge_master
Merge from master
This commit is contained in:
commit
24586d7af5
3
api.go
3
api.go
|
@ -647,9 +647,6 @@ func postContainersStart(srv *Server, version float64, w http.ResponseWriter, r
|
||||||
}
|
}
|
||||||
name := vars["name"]
|
name := vars["name"]
|
||||||
job := srv.Eng.Job("start", name)
|
job := srv.Eng.Job("start", name)
|
||||||
if err := job.ImportEnv(HostConfig{}); err != nil {
|
|
||||||
return fmt.Errorf("Couldn't initialize host configuration")
|
|
||||||
}
|
|
||||||
// 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") {
|
||||||
|
|
|
@ -1302,9 +1302,6 @@ func (container *Container) monitor() {
|
||||||
exitCode = container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
|
exitCode = container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report status back
|
|
||||||
container.State.setStopped(exitCode)
|
|
||||||
|
|
||||||
if container.runtime != nil && container.runtime.srv != nil {
|
if container.runtime != nil && container.runtime.srv != nil {
|
||||||
container.runtime.srv.LogEvent("die", container.ID, container.runtime.repositories.ImageName(container.Image))
|
container.runtime.srv.LogEvent("die", container.ID, container.runtime.repositories.ImageName(container.Image))
|
||||||
}
|
}
|
||||||
|
@ -1317,6 +1314,9 @@ func (container *Container) monitor() {
|
||||||
container.stdin, container.stdinPipe = io.Pipe()
|
container.stdin, container.stdinPipe = io.Pipe()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report status back
|
||||||
|
container.State.setStopped(exitCode)
|
||||||
|
|
||||||
// Release the lock
|
// Release the lock
|
||||||
close(container.waitLock)
|
close(container.waitLock)
|
||||||
|
|
||||||
|
|
23
runtime.go
23
runtime.go
|
@ -134,9 +134,6 @@ func (runtime *Runtime) Register(container *Container) error {
|
||||||
}
|
}
|
||||||
container.rootfs = rootfs
|
container.rootfs = rootfs
|
||||||
|
|
||||||
// init the wait lock
|
|
||||||
container.waitLock = make(chan struct{})
|
|
||||||
|
|
||||||
container.runtime = runtime
|
container.runtime = runtime
|
||||||
|
|
||||||
// Attach to stdout and stderr
|
// Attach to stdout and stderr
|
||||||
|
@ -152,10 +149,6 @@ func (runtime *Runtime) Register(container *Container) error {
|
||||||
runtime.containers.PushBack(container)
|
runtime.containers.PushBack(container)
|
||||||
runtime.idIndex.Add(container.ID)
|
runtime.idIndex.Add(container.ID)
|
||||||
|
|
||||||
// When we actually restart, Start() do the monitoring.
|
|
||||||
// However, when we simply 'reattach', we have to restart a monitor
|
|
||||||
nomonitor := false
|
|
||||||
|
|
||||||
// FIXME: if the container is supposed to be running but is not, auto restart it?
|
// FIXME: if the container is supposed to be running but is not, auto restart it?
|
||||||
// if so, then we need to restart monitor and init a new lock
|
// if so, then we need to restart monitor and init a new lock
|
||||||
// If the container is supposed to be running, make sure of it
|
// If the container is supposed to be running, make sure of it
|
||||||
|
@ -173,7 +166,6 @@ func (runtime *Runtime) Register(container *Container) error {
|
||||||
if err := container.Start(); err != nil {
|
if err := container.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
nomonitor = true
|
|
||||||
} else {
|
} else {
|
||||||
utils.Debugf("Marking as stopped")
|
utils.Debugf("Marking as stopped")
|
||||||
container.State.setStopped(-127)
|
container.State.setStopped(-127)
|
||||||
|
@ -181,17 +173,18 @@ func (runtime *Runtime) Register(container *Container) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
utils.Debugf("Reconnecting to container %v", container.ID)
|
||||||
|
|
||||||
|
if err := container.allocateNetwork(); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the container is not running or just has been flagged not running
|
container.waitLock = make(chan struct{})
|
||||||
// then close the wait lock chan (will be reset upon start)
|
|
||||||
if !container.State.Running {
|
|
||||||
close(container.waitLock)
|
|
||||||
} else if !nomonitor {
|
|
||||||
container.allocateNetwork()
|
|
||||||
go container.monitor()
|
go container.monitor()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue