Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

pkg: oci: fix container rootfs path #192

Merged
merged 1 commit into from Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/oci/utils.go
Expand Up @@ -151,7 +151,10 @@ func PodConfig(runtime RuntimeConfig, bundlePath, cid, console string) (*vc.PodC
return nil, nil, err
}

rootfs := filepath.Join(bundlePath, ocispec.Root.Path)
rootfs := ocispec.Root.Path
if !filepath.IsAbs(rootfs) {
rootfs = filepath.Join(bundlePath, ocispec.Root.Path)
}
ociLog.Debugf("container rootfs: %s", rootfs)

cmd := vc.Cmd{
Expand All @@ -164,7 +167,7 @@ func PodConfig(runtime RuntimeConfig, bundlePath, cid, console string) (*vc.PodC

containerConfig := vc.ContainerConfig{
ID: cid,
RootFs: ocispec.Root.Path,
RootFs: rootfs,
Interactive: ocispec.Process.Terminal,
Console: console,
Cmd: cmd,
Expand Down
2 changes: 1 addition & 1 deletion pkg/oci/utils_test.go
Expand Up @@ -78,7 +78,7 @@ func TestMinimalPodConfig(t *testing.T) {

expectedContainerConfig := vc.ContainerConfig{
ID: containerID,
RootFs: "rootfs",
RootFs: path.Join(tempBundlePath, "rootfs"),
Interactive: true,
Console: consolePath,
Cmd: expectedCmd,
Expand Down