mirror of https://github.com/docker/docs.git
Merge pull request #38 from crosbymichael/add-container-driver
Save driver to container and skip incompat containers
This commit is contained in:
commit
fb245f7903
|
@ -47,6 +47,7 @@ type Container struct {
|
||||||
HostnamePath string
|
HostnamePath string
|
||||||
HostsPath string
|
HostsPath string
|
||||||
Name string
|
Name string
|
||||||
|
Driver string
|
||||||
|
|
||||||
cmd *exec.Cmd
|
cmd *exec.Cmd
|
||||||
stdout *utils.WriteBroadcaster
|
stdout *utils.WriteBroadcaster
|
||||||
|
|
12
runtime.go
12
runtime.go
|
@ -262,6 +262,7 @@ func (runtime *Runtime) restore() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
containers := make(map[string]*Container)
|
containers := make(map[string]*Container)
|
||||||
|
currentDriver := runtime.driver.String()
|
||||||
|
|
||||||
for i, v := range dir {
|
for i, v := range dir {
|
||||||
id := v.Name()
|
id := v.Name()
|
||||||
|
@ -273,8 +274,14 @@ func (runtime *Runtime) restore() error {
|
||||||
utils.Errorf("Failed to load container %v: %v", id, err)
|
utils.Errorf("Failed to load container %v: %v", id, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
utils.Debugf("Loaded container %v", container.ID)
|
|
||||||
containers[container.ID] = container
|
// Ignore the container if it does not support the current driver being used by the graph
|
||||||
|
if container.Driver == "" && currentDriver == "aufs" || container.Driver == currentDriver {
|
||||||
|
utils.Debugf("Loaded container %v", container.ID)
|
||||||
|
containers[container.ID] = container
|
||||||
|
} else {
|
||||||
|
utils.Debugf("Cannot load container %s because it was created with another graph driver.", container.ID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
register := func(container *Container) {
|
register := func(container *Container) {
|
||||||
|
@ -445,6 +452,7 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin
|
||||||
// FIXME: do we need to store this in the container?
|
// FIXME: do we need to store this in the container?
|
||||||
SysInitPath: sysInitPath,
|
SysInitPath: sysInitPath,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
Driver: runtime.driver.String(),
|
||||||
}
|
}
|
||||||
container.root = runtime.containerRoot(container.ID)
|
container.root = runtime.containerRoot(container.ID)
|
||||||
// Step 1: create the container directory.
|
// Step 1: create the container directory.
|
||||||
|
|
Loading…
Reference in New Issue