Windows: hostconfig on start

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-07-16 15:33:13 -07:00
parent 212525f951
commit 39ad38ccf9
1 changed files with 13 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package daemon
import ( import (
"fmt" "fmt"
"runtime"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
) )
@ -24,6 +25,8 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf
return err return err
} }
// Windows does not have the backwards compatibilty issue here.
if runtime.GOOS != "windows" {
// This is kept for backward compatibility - hostconfig should be passed when // This is kept for backward compatibility - hostconfig should be passed when
// creating a container, not during start. // creating a container, not during start.
if hostConfig != nil { if hostConfig != nil {
@ -31,6 +34,11 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf
return err return err
} }
} }
} else {
if hostConfig != nil {
return fmt.Errorf("Supplying a hostconfig on start is not supported. It should be supplied on create")
}
}
if err := container.Start(); err != nil { if err := container.Start(); err != nil {
return fmt.Errorf("Cannot start container %s: %s", name, err) return fmt.Errorf("Cannot start container %s: %s", name, err)