linux: Don't prepend process' cwd if rootfs path is already absolute
If I provide a path starting with `/` I expect that to be honored; otherwise I have to explicitly `(cd /; /path/to/runc)`. Signed-off-by: Colin Walters <walters@redhat.com>
This commit is contained in:
parent
cc16e6b032
commit
83d503e9d7
|
@ -123,9 +123,13 @@ func createLibcontainerConfig(spec *LinuxSpec) (*configs.Config, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
rootfsPath := spec.Root.Path
|
||||||
|
if !filepath.IsAbs(rootfsPath) {
|
||||||
|
rootfsPath = filepath.Join(cwd, rootfsPath)
|
||||||
|
}
|
||||||
config := &configs.Config{
|
config := &configs.Config{
|
||||||
Capabilities: spec.Capabilities,
|
Capabilities: spec.Capabilities,
|
||||||
Rootfs: filepath.Join(cwd, spec.Root.Path),
|
Rootfs: rootfsPath,
|
||||||
Readonlyfs: spec.Root.Readonly,
|
Readonlyfs: spec.Root.Readonly,
|
||||||
Hostname: spec.Hostname,
|
Hostname: spec.Hostname,
|
||||||
Privatefs: true,
|
Privatefs: true,
|
||||||
|
|
Loading…
Reference in New Issue