diff --git a/libnetwork/drivers/bridge/port_mapping_test.go b/libnetwork/drivers/bridge/port_mapping_test.go index c5402cf13d04a..07f38200689ea 100644 --- a/libnetwork/drivers/bridge/port_mapping_test.go +++ b/libnetwork/drivers/bridge/port_mapping_test.go @@ -4,6 +4,7 @@ package bridge import ( + "github.com/docker/docker/libnetwork/ns" "os" "testing" @@ -101,6 +102,10 @@ func TestPortMappingConfig(t *testing.T) { func TestPortMappingV6Config(t *testing.T) { defer testutils.SetupTestOSContext(t)() + if err := loopbackUp(); err != nil { + t.Fatalf("Could not bring loopback iface up: %v", err) + } + d := newDriver() config := &configuration{ @@ -169,3 +174,12 @@ func TestPortMappingV6Config(t *testing.T) { t.Fatal(err) } } + +func loopbackUp() error { + nlHandle := ns.NlHandle() + iface, err := nlHandle.LinkByName("lo") + if err != nil { + return err + } + return nlHandle.LinkSetUp(iface) +}