mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #14691 from Microsoft/10662-start
Windows: hostconfig on start
This commit is contained in:
commit
37d737fc2c
1 changed files with 13 additions and 5 deletions
|
@ -2,6 +2,7 @@ package daemon
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/docker/docker/runconfig"
|
||||
)
|
||||
|
@ -24,11 +25,18 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf
|
|||
return err
|
||||
}
|
||||
|
||||
// This is kept for backward compatibility - hostconfig should be passed when
|
||||
// creating a container, not during start.
|
||||
if hostConfig != nil {
|
||||
if err := daemon.setHostConfig(container, hostConfig); err != nil {
|
||||
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
|
||||
// creating a container, not during start.
|
||||
if hostConfig != nil {
|
||||
if err := daemon.setHostConfig(container, hostConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if hostConfig != nil {
|
||||
return fmt.Errorf("Supplying a hostconfig on start is not supported. It should be supplied on create")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue