From fd435256e7763fc39cf30f92dce6910e2d91463b Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Fri, 31 Mar 2017 14:04:16 -0700 Subject: [PATCH] Set default working directory to / runc/runtime-spec doesn't allow empty working dir Signed-off-by: Mrunal Patel --- server/container_create.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/container_create.go b/server/container_create.go index 04e456a9..78d4fc92 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -520,13 +520,16 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string, // Set working directory // Pick it up from image config first and override if specified in CRI + containerCwd := "/" imageCwd := containerInfo.Config.Config.WorkingDir - specgen.SetProcessCwd(imageCwd) - - cwd := containerConfig.WorkingDir - if cwd != "" { - specgen.SetProcessCwd(cwd) + if imageCwd != "" { + containerCwd = imageCwd } + runtimeCwd := containerConfig.WorkingDir + if runtimeCwd != "" { + containerCwd = runtimeCwd + } + specgen.SetProcessCwd(containerCwd) // Setup user and groups if linux != nil {