From e8c06fac97f56ccc710584731d8b52ed58fbd2dd Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 16 Dec 2021 09:24:24 -0500 Subject: Allow users to add host user accounts to /etc/passwd Some containers require certain user account(s) to exist within the container when they are run. This option will allow callers to add a bunch of passwd entries from the host to the container even if the entries are not in the local /etc/passwd file on the host. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935831 Signed-off-by: Daniel J Walsh --- libpod/options.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libpod/options.go') diff --git a/libpod/options.go b/libpod/options.go index 85d7b4689..204f2a457 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1768,6 +1768,17 @@ func WithPidFile(pidFile string) CtrCreateOption { } } +// WithHostUsers indicates host users to add to /etc/passwd +func WithHostUsers(hostUsers []string) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return define.ErrCtrFinalized + } + ctr.config.HostUsers = hostUsers + return nil + } +} + // WithInitCtrType indicates the container is a initcontainer func WithInitCtrType(containerType string) CtrCreateOption { return func(ctr *Container) error { -- cgit v1.2.3-54-g00ecf