diff --git a/libnetwork/drivers/bridge/bridge.go b/libnetwork/drivers/bridge/bridge.go index ceff412549..c26da23677 100644 --- a/libnetwork/drivers/bridge/bridge.go +++ b/libnetwork/drivers/bridge/bridge.go @@ -3,10 +3,12 @@ package bridge import ( "errors" "net" + "os/exec" "strconv" "strings" "sync" + "github.com/Sirupsen/logrus" "github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/ipallocator" "github.com/docker/libnetwork/netlabel" @@ -104,6 +106,12 @@ func newDriver() driverapi.Driver { // Init registers a new instance of bridge driver func Init(dc driverapi.DriverCallback) error { + // try to modprobe bridge first + // see gh#12177 + if out, err := exec.Command("modprobe", "-va", "bridge", "nf_nat", "br_netfilter").Output(); err != nil { + logrus.Warnf("Running modprobe bridge nf_nat failed with message: %s, error: %v", out, err) + } + return dc.RegisterDriver(networkType, newDriver()) }