summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-12-16 09:24:24 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-12-23 07:51:27 -0500
commite8c06fac97f56ccc710584731d8b52ed58fbd2dd (patch)
treea9ec6546c64a0ae393cda0290256977a63da8eed /libpod/options.go
parenta7f1c05366c86a05e247049f8837b4aadc54fc50 (diff)
downloadpodman-e8c06fac97f56ccc710584731d8b52ed58fbd2dd.tar.gz
podman-e8c06fac97f56ccc710584731d8b52ed58fbd2dd.tar.bz2
podman-e8c06fac97f56ccc710584731d8b52ed58fbd2dd.zip
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 <dwalsh@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go11
1 files changed, 11 insertions, 0 deletions
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 {