Set default working directory to /

runc/runtime-spec doesn't allow empty working dir
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
Mrunal Patel 2017-03-31 14:04:16 -07:00
parent 1ce8be1ccf
commit fd435256e7

View file

@ -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 {