|
@@ -1,6 +1,7 @@
|
|
package docker
|
|
package docker
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "bytes"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"errors"
|
|
"errors"
|
|
"flag"
|
|
"flag"
|
|
@@ -847,15 +848,15 @@ func (container *Container) Start(hostConfig *HostConfig) (err error) {
|
|
// Note: The container can run and finish correctly before
|
|
// Note: The container can run and finish correctly before
|
|
// the end of this loop
|
|
// the end of this loop
|
|
for now := time.Now(); time.Since(now) < 5*time.Second; {
|
|
for now := time.Now(); time.Since(now) < 5*time.Second; {
|
|
- // If the container dies while waiting for it, just reutrn
|
|
|
|
|
|
+ // If the container dies while waiting for it, just return
|
|
if !container.State.Running {
|
|
if !container.State.Running {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
- output, err := exec.Command("lxc-info", "-n", container.ID).CombinedOutput()
|
|
|
|
|
|
+ output, err := exec.Command("lxc-info", "-s", "-n", container.ID).CombinedOutput()
|
|
if err != nil {
|
|
if err != nil {
|
|
utils.Debugf("Error with lxc-info: %s (%s)", err, output)
|
|
utils.Debugf("Error with lxc-info: %s (%s)", err, output)
|
|
|
|
|
|
- output, err = exec.Command("lxc-info", "-n", container.ID).CombinedOutput()
|
|
|
|
|
|
+ output, err = exec.Command("lxc-info", "-s", "-n", container.ID).CombinedOutput()
|
|
if err != nil {
|
|
if err != nil {
|
|
utils.Debugf("Second Error with lxc-info: %s (%s)", err, output)
|
|
utils.Debugf("Second Error with lxc-info: %s (%s)", err, output)
|
|
return err
|
|
return err
|
|
@@ -865,7 +866,7 @@ func (container *Container) Start(hostConfig *HostConfig) (err error) {
|
|
if strings.Contains(string(output), "RUNNING") {
|
|
if strings.Contains(string(output), "RUNNING") {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
- utils.Debugf("Waiting for the container to start (running: %v): %s\n", container.State.Running, output)
|
|
|
|
|
|
+ utils.Debugf("Waiting for the container to start (running: %v): %s", container.State.Running, bytes.TrimSpace(output))
|
|
time.Sleep(50 * time.Millisecond)
|
|
time.Sleep(50 * time.Millisecond)
|
|
}
|
|
}
|
|
|
|
|