diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 5 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 5 | ||||
-rw-r--r-- | libpod/networking_linux.go | 8 |
3 files changed, 12 insertions, 6 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 6717ada59..9082b136a 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1072,6 +1072,11 @@ func (c *Container) init(ctx context.Context, retainRetries bool) error { return err } + // Make sure the workdir exists while initializing container + if err := c.resolveWorkDir(); err != nil { + return err + } + // Save the OCI newSpec to disk if err := c.saveSpec(newSpec); err != nil { return err diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 8b73c82de..b624f44ac 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -176,11 +176,6 @@ func (c *Container) prepare() error { return err } - // Make sure the workdir exists - if err := c.resolveWorkDir(); err != nil { - return err - } - return nil } diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 5ade0849d..9aa6cab15 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -185,7 +185,13 @@ func (r *RootlessCNI) Do(toRun func() error) error { // if there is no symlink exit break } - resolvePath = filepath.Join(filepath.Dir(resolvePath), link) + if filepath.IsAbs(link) { + // link is as an absolute path + resolvePath = link + } else { + // link is as a relative, join it with the previous path + resolvePath = filepath.Join(filepath.Dir(resolvePath), link) + } if strings.HasPrefix(resolvePath, "/run/") { break } |