mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #17524 from mountkin/fix-teardown
dont try to remove builtin networks in teardown
This commit is contained in:
commit
cccb6bce7d
1 changed files with 10 additions and 9 deletions
|
@ -598,15 +598,16 @@ func deleteAllNetworks() error {
|
|||
}
|
||||
var errors []string
|
||||
for _, n := range networks {
|
||||
if n.Name != "bridge" {
|
||||
status, b, err := sockRequest("DELETE", "/networks/"+n.Name, nil)
|
||||
if err != nil {
|
||||
errors = append(errors, err.Error())
|
||||
continue
|
||||
}
|
||||
if status != http.StatusNoContent {
|
||||
errors = append(errors, fmt.Sprintf("error deleting network %s: %s", n.Name, string(b)))
|
||||
}
|
||||
if n.Name == "bridge" || n.Name == "none" || n.Name == "host" {
|
||||
continue
|
||||
}
|
||||
status, b, err := sockRequest("DELETE", "/networks/"+n.Name, nil)
|
||||
if err != nil {
|
||||
errors = append(errors, err.Error())
|
||||
continue
|
||||
}
|
||||
if status != http.StatusNoContent {
|
||||
errors = append(errors, fmt.Sprintf("error deleting network %s: %s", n.Name, string(b)))
|
||||
}
|
||||
}
|
||||
if len(errors) > 0 {
|
||||
|
|
Loading…
Reference in a new issue