|
@@ -100,17 +100,25 @@ func createContainer(id string, root string, command string, args []string, imag
|
|
return container, nil
|
|
return container, nil
|
|
}
|
|
}
|
|
|
|
|
|
-func loadContainer(containerPath string) (*Container, error) {
|
|
|
|
|
|
+func loadContainer(store *fs.Store, containerPath string) (*Container, error) {
|
|
data, err := ioutil.ReadFile(path.Join(containerPath, "config.json"))
|
|
data, err := ioutil.ReadFile(path.Join(containerPath, "config.json"))
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
+ mountpoint, err := store.FetchMountpoint(
|
|
|
|
+ path.Join(containerPath, "rootfs"),
|
|
|
|
+ path.Join(containerPath, "rw"),
|
|
|
|
+ )
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
container := &Container{
|
|
container := &Container{
|
|
stdout: newWriteBroadcaster(),
|
|
stdout: newWriteBroadcaster(),
|
|
stderr: newWriteBroadcaster(),
|
|
stderr: newWriteBroadcaster(),
|
|
stdoutLog: new(bytes.Buffer),
|
|
stdoutLog: new(bytes.Buffer),
|
|
stderrLog: new(bytes.Buffer),
|
|
stderrLog: new(bytes.Buffer),
|
|
lxcConfigPath: path.Join(containerPath, "config.lxc"),
|
|
lxcConfigPath: path.Join(containerPath, "config.lxc"),
|
|
|
|
+ Mountpoint: mountpoint,
|
|
}
|
|
}
|
|
if err := json.Unmarshal(data, container); err != nil {
|
|
if err := json.Unmarshal(data, container); err != nil {
|
|
return nil, err
|
|
return nil, err
|