Merge pull request #1429 from dmcgowan/client-use-root-path
Use RootPath for resolving path inside of an image
This commit is contained in:
commit
360e46ddda
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
|
"github.com/containerd/containerd/fs"
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/opencontainers/image-spec/identity"
|
"github.com/opencontainers/image-spec/identity"
|
||||||
@ -322,7 +323,11 @@ func WithUserID(uid uint32) SpecOpts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer unix.Unmount(root, 0)
|
defer unix.Unmount(root, 0)
|
||||||
f, err := os.Open(filepath.Join(root, "/etc/passwd"))
|
ppath, err := fs.RootPath(root, "/etc/passwd")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f, err := os.Open(ppath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -370,7 +375,11 @@ func WithUsername(username string) SpecOpts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer unix.Unmount(root, 0)
|
defer unix.Unmount(root, 0)
|
||||||
f, err := os.Open(filepath.Join(root, "/etc/passwd"))
|
ppath, err := fs.RootPath(root, "/etc/passwd")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f, err := os.Open(ppath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user