@@ -94,7 +94,7 @@ func newProcess(p specs.Process) (*libcontainer.Process, error) {
94
94
}
95
95
96
96
// setupIO modifies the given process config according to the options.
97
- func setupIO (process * libcontainer.Process , rootuid , rootgid int , createTTY , detach bool , sockpath string ) (* tty , error ) {
97
+ func setupIO (process * libcontainer.Process , containerUID , containerGID int , createTTY , detach bool , sockpath string ) (* tty , error ) {
98
98
if createTTY {
99
99
process .Stdin = nil
100
100
process .Stdout = nil
@@ -140,7 +140,7 @@ func setupIO(process *libcontainer.Process, rootuid, rootgid int, createTTY, det
140
140
inheritStdio (process )
141
141
return & tty {}, nil
142
142
}
143
- return setupProcessPipes (process , rootuid , rootgid )
143
+ return setupProcessPipes (process , containerUID , containerGID )
144
144
}
145
145
146
146
// createPidFile creates a file containing the PID,
@@ -237,11 +237,11 @@ func (r *runner) run(config *specs.Process) (int, error) {
237
237
}
238
238
process .ExtraFiles = append (process .ExtraFiles , os .NewFile (uintptr (i ), "PreserveFD:" + strconv .Itoa (i )))
239
239
}
240
- rootuid , err := r .container .Config ().HostRootUID ( )
240
+ containerUID , err := r .container .Config ().HostUID ( int ( config . User . UID ) )
241
241
if err != nil {
242
242
return - 1 , err
243
243
}
244
- rootgid , err := r .container .Config ().HostRootGID ( )
244
+ containerGID , err := r .container .Config ().HostGID ( int ( config . User . GID ) )
245
245
if err != nil {
246
246
return - 1 , err
247
247
}
@@ -250,7 +250,7 @@ func (r *runner) run(config *specs.Process) (int, error) {
250
250
// with detaching containers, and then we get a tty after the container has
251
251
// started.
252
252
handler := newSignalHandler (r .enableSubreaper , r .notifySocket )
253
- tty , err := setupIO (process , rootuid , rootgid , config .Terminal , detach , r .consoleSocket )
253
+ tty , err := setupIO (process , containerUID , containerGID , config .Terminal , detach , r .consoleSocket )
254
254
if err != nil {
255
255
return - 1 , err
256
256
}
0 commit comments