summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-07 19:23:27 +0200
committerGitHub <noreply@github.com>2020-07-07 19:23:27 +0200
commit54d16f3b5fc4210c7c46e4cca240f988fa5f39f5 (patch)
tree5cd32e61758c7c43ed44b2529cafc8281b46a910 /libpod/container.go
parentcd084853b6187d8b236ea327818277cc02e0b916 (diff)
parent6c6670f12a3e6b91c1ebb09e7d9e4f49f89dccc0 (diff)
downloadpodman-54d16f3b5fc4210c7c46e4cca240f988fa5f39f5.tar.gz
podman-54d16f3b5fc4210c7c46e4cca240f988fa5f39f5.tar.bz2
podman-54d16f3b5fc4210c7c46e4cca240f988fa5f39f5.zip
Merge pull request #6829 from rhatdan/keepid
Add username to /etc/passwd inside of container if --userns keep-id
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index fa90fef7a..f7abfb005 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -278,6 +278,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
@@ -786,7 +789,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