From ec1f350ee5a3776f6fac6e96e1277d0ab36d130a Mon Sep 17 00:00:00 2001 From: flouthoc Date: Mon, 30 Aug 2021 11:52:15 +0530 Subject: container: resolve workdir after all the mounts happen. There are use-cases where users would want to use overlay-mounts as workdir. For such cases workdir should be resolved after all the mounts are completed during the container init process. Signed-off-by: Aditya Rajan --- libpod/container_internal.go | 5 +++++ libpod/container_internal_linux.go | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libpod') 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 } -- cgit v1.2.3-54-g00ecf