only perform chown operation for non root users (#1250)
This commit is contained in:
parent
91296bd5eb
commit
a5ceb54caf
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
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
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue