1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Modprobe bridge driver r specific kernel modules

Try too modprobe bridge driverer specic modulein case
they are not loaded into the kernel.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
Jana Radhakrishnan 2015-05-28 20:01:00 +00:00 committed by Madhu Venugopal
parent db5f2f40fb
commit 61993ec6c2

View file

@ -3,10 +3,12 @@ package bridge
import ( import (
"errors" "errors"
"net" "net"
"os/exec"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"github.com/Sirupsen/logrus"
"github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/driverapi"
"github.com/docker/libnetwork/ipallocator" "github.com/docker/libnetwork/ipallocator"
"github.com/docker/libnetwork/netlabel" "github.com/docker/libnetwork/netlabel"
@ -104,6 +106,12 @@ func newDriver() driverapi.Driver {
// Init registers a new instance of bridge driver // Init registers a new instance of bridge driver
func Init(dc driverapi.DriverCallback) error { 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()) return dc.RegisterDriver(networkType, newDriver())
} }