From ba69f5d4884e0a076ce682e7b6ef6de30c5df065 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 22 Aug 2017 11:41:17 -0400 Subject: [PATCH] Add WithUserIDs SpecOpt Signed-off-by: Michael Crosby --- spec_opts_unix.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec_opts_unix.go b/spec_opts_unix.go index 3e35c18c8..a2a040a0e 100644 --- a/spec_opts_unix.go +++ b/spec_opts_unix.go @@ -289,3 +289,12 @@ func WithNamespacedCgroup(ctx context.Context, id string) SpecOpts { return nil } } + +// WithUserIDs allows the UID and GID for the Process to be set +func WithUserIDs(uid, gid uint32) SpecOpts { + return func(s *specs.Spec) error { + s.Process.User.UID = uid + s.Process.User.GID = gid + return nil + } +}