diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go index 7f0a577..faf11a8 100644 --- a/pkg/container/docker_run.go +++ b/pkg/container/docker_run.go @@ -130,7 +130,9 @@ func (cr *containerReference) Start(attach bool) common.Executor { cr.tryReadGID(), func(ctx context.Context) error { // If this fails, then folders have wrong permissions on non root container - _ = cr.Exec([]string{"chown", "-R", fmt.Sprintf("%d:%d", cr.UID, cr.GID), cr.input.WorkingDir}, nil, "0", "")(ctx) + if cr.UID != 0 || cr.GID != 0 { + _ = cr.Exec([]string{"chown", "-R", fmt.Sprintf("%d:%d", cr.UID, cr.GID), cr.input.WorkingDir}, nil, "0", "")(ctx) + } return nil }, ).IfNot(common.Dryrun), @@ -165,7 +167,9 @@ func (cr *containerReference) CopyDir(destPath string, srcPath string, useGitIgn cr.copyDir(destPath, srcPath, useGitIgnore), func(ctx context.Context) error { // If this fails, then folders have wrong permissions on non root container - _ = cr.Exec([]string{"chown", "-R", fmt.Sprintf("%d:%d", cr.UID, cr.GID), destPath}, nil, "0", "")(ctx) + if cr.UID != 0 || cr.GID != 0 { + _ = cr.Exec([]string{"chown", "-R", fmt.Sprintf("%d:%d", cr.UID, cr.GID), destPath}, nil, "0", "")(ctx) + } return nil }, ).IfNot(common.Dryrun)