|
@@ -910,7 +910,8 @@ func (container *Container) initializeNetworking() error {
|
|
container.HostsPath = hostsPath
|
|
container.HostsPath = hostsPath
|
|
|
|
|
|
return ioutil.WriteFile(container.HostsPath, content, 0644)
|
|
return ioutil.WriteFile(container.HostsPath, content, 0644)
|
|
- } else if container.hostConfig.NetworkMode.IsContainer() {
|
|
|
|
|
|
+ }
|
|
|
|
+ if container.hostConfig.NetworkMode.IsContainer() {
|
|
// we need to get the hosts files from the container to join
|
|
// we need to get the hosts files from the container to join
|
|
nc, err := container.getNetworkedContainer()
|
|
nc, err := container.getNetworkedContainer()
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -920,16 +921,16 @@ func (container *Container) initializeNetworking() error {
|
|
container.ResolvConfPath = nc.ResolvConfPath
|
|
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
|
|
- } else if container.daemon.config.DisableNetwork {
|
|
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
|
|
+ if container.daemon.config.DisableNetwork {
|
|
container.Config.NetworkDisabled = true
|
|
container.Config.NetworkDisabled = true
|
|
return container.buildHostnameAndHostsFiles("127.0.1.1")
|
|
return container.buildHostnameAndHostsFiles("127.0.1.1")
|
|
- } else {
|
|
|
|
- if err := container.allocateNetwork(); err != nil {
|
|
|
|
- return err
|
|
|
|
- }
|
|
|
|
- return container.buildHostnameAndHostsFiles(container.NetworkSettings.IPAddress)
|
|
|
|
}
|
|
}
|
|
- return nil
|
|
|
|
|
|
+ if err := container.allocateNetwork(); err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ return container.buildHostnameAndHostsFiles(container.NetworkSettings.IPAddress)
|
|
}
|
|
}
|
|
|
|
|
|
// Make sure the config is compatible with the current kernel
|
|
// Make sure the config is compatible with the current kernel
|