mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add flag to set default graph driver
Remove the env var DOCKER_DRIVER
This commit is contained in:
parent
f6629bbbd5
commit
6dbeed89c0
4 changed files with 13 additions and 4 deletions
|
@ -16,6 +16,7 @@ type DaemonConfig struct {
|
||||||
BridgeIface string
|
BridgeIface string
|
||||||
DefaultIp net.IP
|
DefaultIp net.IP
|
||||||
InterContainerCommunication bool
|
InterContainerCommunication bool
|
||||||
|
GraphDriver string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigFromJob creates and returns a new DaemonConfig object
|
// ConfigFromJob creates and returns a new DaemonConfig object
|
||||||
|
@ -37,5 +38,6 @@ func ConfigFromJob(job *engine.Job) *DaemonConfig {
|
||||||
}
|
}
|
||||||
config.DefaultIp = net.ParseIP(job.Getenv("DefaultIp"))
|
config.DefaultIp = net.ParseIP(job.Getenv("DefaultIp"))
|
||||||
config.InterContainerCommunication = job.GetenvBool("InterContainerCommunication")
|
config.InterContainerCommunication = job.GetenvBool("InterContainerCommunication")
|
||||||
|
config.GraphDriver = job.Getenv("GraphDriver")
|
||||||
return &config
|
return &config
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ func main() {
|
||||||
flEnableIptables := flag.Bool("iptables", true, "Disable iptables within docker")
|
flEnableIptables := flag.Bool("iptables", true, "Disable iptables within docker")
|
||||||
flDefaultIp := flag.String("ip", "0.0.0.0", "Default ip address to use when binding a containers ports")
|
flDefaultIp := flag.String("ip", "0.0.0.0", "Default ip address to use when binding a containers ports")
|
||||||
flInterContainerComm := flag.Bool("icc", true, "Enable inter-container communication")
|
flInterContainerComm := flag.Bool("icc", true, "Enable inter-container communication")
|
||||||
|
flGraphDriver := flag.String("graph-driver", "", "For docker to use a specific graph driver")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ func main() {
|
||||||
job.Setenv("BridgeIface", *bridgeName)
|
job.Setenv("BridgeIface", *bridgeName)
|
||||||
job.Setenv("DefaultIp", *flDefaultIp)
|
job.Setenv("DefaultIp", *flDefaultIp)
|
||||||
job.SetenvBool("InterContainerCommunication", *flInterContainerComm)
|
job.SetenvBool("InterContainerCommunication", *flInterContainerComm)
|
||||||
|
job.Setenv("GraphDriver", *flGraphDriver)
|
||||||
if err := job.Run(); err != nil {
|
if err := job.Run(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dotcloud/docker/archive"
|
"github.com/dotcloud/docker/archive"
|
||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
"os"
|
|
||||||
"path"
|
"path"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var DefaultDriver string
|
||||||
|
|
||||||
type InitFunc func(root string) (Driver, error)
|
type InitFunc func(root string) (Driver, error)
|
||||||
|
|
||||||
type Driver interface {
|
type Driver interface {
|
||||||
|
@ -64,9 +65,9 @@ func GetDriver(name, home string) (Driver, error) {
|
||||||
func New(root string) (Driver, error) {
|
func New(root string) (Driver, error) {
|
||||||
var driver Driver
|
var driver Driver
|
||||||
var lastError error
|
var lastError error
|
||||||
// Use environment variable DOCKER_DRIVER to force a choice of driver
|
|
||||||
if name := os.Getenv("DOCKER_DRIVER"); name != "" {
|
if DefaultDriver != "" {
|
||||||
return GetDriver(name, root)
|
return GetDriver(DefaultDriver, root)
|
||||||
}
|
}
|
||||||
// Check for priority drivers first
|
// Check for priority drivers first
|
||||||
for _, name := range priority {
|
for _, name := range priority {
|
||||||
|
|
|
@ -637,6 +637,10 @@ func NewRuntime(config *DaemonConfig) (*Runtime, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
||||||
|
|
||||||
|
// Set the default driver
|
||||||
|
graphdriver.DefaultDriver = config.GraphDriver
|
||||||
|
|
||||||
// Load storage driver
|
// Load storage driver
|
||||||
driver, err := graphdriver.New(config.Root)
|
driver, err := graphdriver.New(config.Root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue