mirror of
https://github.com/docker/cli.git
synced 2026-09-27 17:56:04 -04:00
Merge pull request #13440 from LK4D4/fix_bridge_none
Fix network with -b none Upstream-commit: 47e727d1fcef00c270851ecc3e5efa7d7b65240d Component: engine
This commit is contained in:
@@ -182,17 +182,20 @@ func getDevicesFromPath(deviceMapping runconfig.DeviceMapping) (devs []*configs.
|
||||
}
|
||||
|
||||
func populateCommand(c *Container, env []string) error {
|
||||
en := &execdriver.Network{
|
||||
NamespacePath: c.NetworkSettings.SandboxKey,
|
||||
}
|
||||
var en *execdriver.Network
|
||||
if !c.daemon.config.DisableNetwork {
|
||||
en = &execdriver.Network{
|
||||
NamespacePath: c.NetworkSettings.SandboxKey,
|
||||
}
|
||||
|
||||
parts := strings.SplitN(string(c.hostConfig.NetworkMode), ":", 2)
|
||||
if parts[0] == "container" {
|
||||
nc, err := c.getNetworkedContainer()
|
||||
if err != nil {
|
||||
return err
|
||||
parts := strings.SplitN(string(c.hostConfig.NetworkMode), ":", 2)
|
||||
if parts[0] == "container" {
|
||||
nc, err := c.getNetworkedContainer()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
en.ContainerID = nc.ID
|
||||
}
|
||||
en.ContainerID = nc.ID
|
||||
}
|
||||
|
||||
ipc := &execdriver.Ipc{}
|
||||
@@ -906,7 +909,7 @@ func (container *Container) getNetworkedContainer() (*Container, error) {
|
||||
}
|
||||
|
||||
func (container *Container) ReleaseNetwork() {
|
||||
if container.hostConfig.NetworkMode.IsContainer() {
|
||||
if container.hostConfig.NetworkMode.IsContainer() || container.daemon.config.DisableNetwork {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ func generateIfaceName() (string, error) {
|
||||
}
|
||||
|
||||
func (d *driver) createNetwork(container *configs.Config, c *execdriver.Command) error {
|
||||
if c.Network == nil {
|
||||
return nil
|
||||
}
|
||||
if c.Network.ContainerID != "" {
|
||||
d.Lock()
|
||||
active := d.activeContainers[c.Network.ContainerID]
|
||||
|
||||
Reference in New Issue
Block a user