Skip to content

Commit 9f83bc8

Browse files
KerchumA222kylecarbs
authored andcommitted
Set default UserId and GroupId to 0:0
Update to match Dockerfile specifications when using ADD or COPY Previous functionality was to preserve the user and group from the source, which may not exist in the container. Fixes GoogleContainerTools#1921
1 parent f9ad3d5 commit 9f83bc8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/util/command_util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Loop:
347347

348348
func GetUserGroup(chownStr string, env []string) (int64, int64, error) {
349349
if chownStr == "" {
350-
return DoNotChangeUID, DoNotChangeGID, nil
350+
return 0, 0, nil
351351
}
352352

353353
chown, err := ResolveEnvironmentReplacement(chownStr, env, false)

pkg/util/command_util_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ func TestGetUserGroup(t *testing.T) {
561561
mockIDGetter: func(string, string, bool) (uint32, uint32, error) {
562562
return 0, 0, fmt.Errorf("should not be called")
563563
},
564-
expectedU: -1,
565-
expectedG: -1,
564+
expectedU: 0,
565+
expectedG: 0,
566566
},
567567
}
568568
for _, tc := range tests {

0 commit comments

Comments
 (0)