mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Set DOCKER_DRIVER to override the choice of driver (aufs, devicemapper or dummy)
This commit is contained in:
parent
1e5c61041f
commit
8c21d2acd3
1 changed files with 16 additions and 6 deletions
|
@ -3,6 +3,7 @@ package graphdriver
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dotcloud/docker/archive"
|
"github.com/dotcloud/docker/archive"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,19 +46,28 @@ func Register(name string, initFunc InitFunc) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDriver(name, home string) (Driver, error) {
|
||||||
|
if initFunc, exists := drivers[name]; exists {
|
||||||
|
return initFunc(home)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("No such driver: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
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 != "" {
|
||||||
|
return getDriver(name, root)
|
||||||
|
}
|
||||||
// Check for priority drivers first
|
// Check for priority drivers first
|
||||||
for _, name := range priority {
|
for _, name := range priority {
|
||||||
if initFunc, exists := drivers[name]; exists {
|
driver, lastError = getDriver(name, root)
|
||||||
driver, lastError = initFunc(root)
|
|
||||||
if lastError != nil {
|
if lastError != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return driver, nil
|
return driver, nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check all registered drivers if no priority driver is found
|
// Check all registered drivers if no priority driver is found
|
||||||
for _, initFunc := range drivers {
|
for _, initFunc := range drivers {
|
||||||
|
|
Loading…
Add table
Reference in a new issue