summaryrefslogtreecommitdiffhomepage
path: root/runsc/dockerutil/dockerutil.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-09-23 17:04:45 -0700
committergVisor bot <gvisor-bot@google.com>2019-09-23 17:06:02 -0700
commitf2ea8e6b249d729d4616ee219c0472bfff93a575 (patch)
tree5e4a6ebe0abaffeb2e0e2c7777f41e541a038f27 /runsc/dockerutil/dockerutil.go
parent6c88f674afb6065995d5758eb8cf288578d21c3d (diff)
Always set HOME env var with `runsc exec`.
We already do this for `runsc run`, but need to do the same for `runsc exec`. PiperOrigin-RevId: 270793459
Diffstat (limited to 'runsc/dockerutil/dockerutil.go')
-rw-r--r--runsc/dockerutil/dockerutil.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/runsc/dockerutil/dockerutil.go b/runsc/dockerutil/dockerutil.go
index c073d8f75..e37ec0ffd 100644
--- a/runsc/dockerutil/dockerutil.go
+++ b/runsc/dockerutil/dockerutil.go
@@ -287,6 +287,14 @@ func (d *Docker) Exec(args ...string) (string, error) {
return do(a...)
}
+// ExecAsUser calls 'docker exec' as the given user with the arguments
+// provided.
+func (d *Docker) ExecAsUser(user string, args ...string) (string, error) {
+ a := []string{"exec", "--user", user, d.Name}
+ a = append(a, args...)
+ return do(a...)
+}
+
// ExecWithTerminal calls 'docker exec -it' with the arguments provided and
// attaches a pty to stdio.
func (d *Docker) ExecWithTerminal(args ...string) (*exec.Cmd, *os.File, error) {