diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-09-21 10:15:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-21 10:15:32 +0200 |
commit | 819b63c8de310d37a8658ee70fa3b825162a3e17 (patch) | |
tree | 7a579c4d3e8dea620ee63457cc453b3cf373baf6 /libpod | |
parent | 66f4bc76384cca8716f9192aa279138cb2b35812 (diff) | |
parent | e42e1c45ae761b203dd5312c22ee7992eef322dc (diff) | |
download | podman-819b63c8de310d37a8658ee70fa3b825162a3e17.tar.gz podman-819b63c8de310d37a8658ee70fa3b825162a3e17.tar.bz2 podman-819b63c8de310d37a8658ee70fa3b825162a3e17.zip |
Merge pull request #4068 from giuseppe/always-set-home
container: make sure $HOME is always set
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_linux.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 4bbbef5db..355b9bea4 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -279,6 +279,17 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { } } + hasHomeSet := false + for _, s := range c.config.Spec.Process.Env { + if strings.HasPrefix(s, "HOME=") { + hasHomeSet = true + break + } + } + if !hasHomeSet { + c.config.Spec.Process.Env = append(c.config.Spec.Process.Env, fmt.Sprintf("HOME=%s", execUser.Home)) + } + if c.config.User != "" { // User and Group must go together g.SetProcessUID(uint32(execUser.Uid)) |