mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #27367 from Microsoft/jjh/fieldsincontainer
Windows: Factor out unused fields in container
This commit is contained in:
commit
b0f3d7a1b5
4 changed files with 37 additions and 16 deletions
|
@ -17,9 +17,6 @@ import (
|
||||||
type Container struct {
|
type Container struct {
|
||||||
CommonContainer
|
CommonContainer
|
||||||
|
|
||||||
HostnamePath string
|
|
||||||
HostsPath string
|
|
||||||
ResolvConfPath string
|
|
||||||
// Fields below here are platform specific.
|
// Fields below here are platform specific.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,17 +63,9 @@ func (daemon *Daemon) buildSandboxOptions(container *container.Container) ([]lib
|
||||||
sboxOptions = append(sboxOptions, libnetwork.OptionUseExternalKey())
|
sboxOptions = append(sboxOptions, libnetwork.OptionUseExternalKey())
|
||||||
}
|
}
|
||||||
|
|
||||||
container.HostsPath, err = container.GetRootResourcePath("hosts")
|
if err = setupPathsAndSandboxOptions(container, &sboxOptions); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
sboxOptions = append(sboxOptions, libnetwork.OptionHostsPath(container.HostsPath))
|
|
||||||
|
|
||||||
container.ResolvConfPath, err = container.GetRootResourcePath("resolv.conf")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
sboxOptions = append(sboxOptions, libnetwork.OptionResolvConfPath(container.ResolvConfPath))
|
|
||||||
|
|
||||||
if len(container.HostConfig.DNS) > 0 {
|
if len(container.HostConfig.DNS) > 0 {
|
||||||
dns = container.HostConfig.DNS
|
dns = container.HostConfig.DNS
|
||||||
|
@ -809,9 +801,7 @@ func (daemon *Daemon) initializeNetworking(container *container.Container) error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
container.HostnamePath = nc.HostnamePath
|
initializeNetworkingPaths(container, nc)
|
||||||
container.HostsPath = nc.HostsPath
|
|
||||||
container.ResolvConfPath = nc.ResolvConfPath
|
|
||||||
container.Config.Hostname = nc.Config.Hostname
|
container.Config.Hostname = nc.Config.Hostname
|
||||||
container.Config.Domainname = nc.Config.Domainname
|
container.Config.Domainname = nc.Config.Domainname
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/runconfig"
|
"github.com/docker/docker/runconfig"
|
||||||
|
"github.com/docker/libnetwork"
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
"github.com/opencontainers/runc/libcontainer/devices"
|
||||||
"github.com/opencontainers/runc/libcontainer/label"
|
"github.com/opencontainers/runc/libcontainer/label"
|
||||||
|
@ -328,3 +329,26 @@ func enableIPOnPredefinedNetwork() bool {
|
||||||
func (daemon *Daemon) isNetworkHotPluggable() bool {
|
func (daemon *Daemon) isNetworkHotPluggable() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setupPathsAndSandboxOptions(container *container.Container, sboxOptions *[]libnetwork.SandboxOption) error {
|
||||||
|
var err error
|
||||||
|
|
||||||
|
container.HostsPath, err = container.GetRootResourcePath("hosts")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*sboxOptions = append(*sboxOptions, libnetwork.OptionHostsPath(container.HostsPath))
|
||||||
|
|
||||||
|
container.ResolvConfPath, err = container.GetRootResourcePath("resolv.conf")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*sboxOptions = append(*sboxOptions, libnetwork.OptionResolvConfPath(container.ResolvConfPath))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func initializeNetworkingPaths(container *container.Container, nc *container.Container) {
|
||||||
|
container.HostnamePath = nc.HostnamePath
|
||||||
|
container.HostsPath = nc.HostsPath
|
||||||
|
container.ResolvConfPath = nc.ResolvConfPath
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import "github.com/docker/docker/container"
|
import (
|
||||||
|
"github.com/docker/docker/container"
|
||||||
|
"github.com/docker/libnetwork"
|
||||||
|
)
|
||||||
|
|
||||||
func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) {
|
func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -47,3 +50,10 @@ func enableIPOnPredefinedNetwork() bool {
|
||||||
func (daemon *Daemon) isNetworkHotPluggable() bool {
|
func (daemon *Daemon) isNetworkHotPluggable() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setupPathsAndSandboxOptions(container *container.Container, sboxOptions *[]libnetwork.SandboxOption) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func initializeNetworkingPaths(container *container.Container, nc *container.Container) {
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue