1
0
mirror of https://github.com/moby/moby.git synced 2025-10-24 09:13:09 +03:00

Fix issue in disconnecting a container from network

This fix tries to address the issue raised in 26220 where
disconnecting a container from network does not work if
the network id (instead of network name) has been specified.

The issue was that internally when trying to disconnecting
a contaienr fromt the network, the originally passed network
name or id has been used.

This fix uses the resolved network name (e.g., `bridge`).

An integration test has been added to cover the changes.

This fix fixes 26220.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2016-09-03 17:14:48 -07:00
parent 93a8b5c42b
commit 83d79f13aa
2 changed files with 18 additions and 0 deletions

View File

@@ -1756,3 +1756,16 @@ func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *check.C) {
_, _, err = dockerCmdWithError("run", "--net=mynet", "--ip6", "::ffff:172.28.99.99", "busybox", "top")
c.Assert(err.Error(), checker.Contains, "invalid IPv6 address")
}
// Test case for 26220
func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromBridge(c *check.C) {
out, _ := dockerCmd(c, "network", "inspect", "--format", "{{.Id}}", "bridge")
network := strings.TrimSpace(out)
name := "test"
dockerCmd(c, "create", "--rm", "--name", name, "busybox", "top")
_, _, err := dockerCmdWithError("network", "disconnect", network, name)
c.Assert(err, check.IsNil)
}