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

bugfix: prevent creating network 'default'

Default is predefined network and is reserved, so we should stop user
from creating network with name `default`

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
Zhang Wei
2016-01-19 10:12:02 +08:00
parent 82401a4b13
commit 31dae442c8
2 changed files with 19 additions and 1 deletions

View File

@@ -277,6 +277,24 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsDefault(c *check.C) {
}
}
func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *check.C) {
predefined := []string{"bridge", "host", "none", "default"}
for _, net := range predefined {
// predefined networks can't be created again
out, _, err := dockerCmdWithError("network", "create", net)
c.Assert(err, checker.NotNil, check.Commentf("%v", out))
}
}
func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) {
predefined := []string{"bridge", "host", "none", "default"}
for _, net := range predefined {
// predefined networks can't be removed
out, _, err := dockerCmdWithError("network", "rm", net)
c.Assert(err, checker.NotNil, check.Commentf("%v", out))
}
}
func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) {
out, _ := dockerCmd(c, "network", "create", "dev")
defer func() {