diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-30 15:44:14 -0400 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-08-11 14:58:29 +0200 |
commit | 3dfd8630a51a37734ad8c51162c4d004b8ffffb2 (patch) | |
tree | 6ebf1d923f718c6717add408a11c714070ccc995 /libpod/container.go | |
parent | 92d01d76c63d0a286365f610151524fb24b74e16 (diff) | |
download | podman-3dfd8630a51a37734ad8c51162c4d004b8ffffb2.tar.gz podman-3dfd8630a51a37734ad8c51162c4d004b8ffffb2.tar.bz2 podman-3dfd8630a51a37734ad8c51162c4d004b8ffffb2.zip |
Add username to /etc/passwd inside of container if --userns keep-id
If I enter a continer with --userns keep-id, my UID will be present
inside of the container, but most likely my user will not be defined.
This patch will take information about the user and stick it into the
container.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go index 6a87ad3a9..9ad938a5c 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -277,6 +277,9 @@ type ContainerConfig struct { User string `json:"user,omitempty"` // Additional groups to add Groups []string `json:"groups,omitempty"` + // AddCurrentUserPasswdEntry indicates that the current user passwd entry + // should be added to the /etc/passwd within the container + AddCurrentUserPasswdEntry bool `json:"addCurrentUserPasswdEntry,omitempty"` // Namespace Config // IDs of container to share namespaces with @@ -774,7 +777,10 @@ func (c *Container) Hostname() string { // WorkingDir returns the containers working dir func (c *Container) WorkingDir() string { - return c.config.Spec.Process.Cwd + if c.config.Spec.Process != nil { + return c.config.Spec.Process.Cwd + } + return "/" } // State Accessors |