diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-03-23 14:12:07 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-03-23 15:05:30 -0400 |
commit | 5e28cbc5fcdd89fc3623fe2324d7ba7fa6117d21 (patch) | |
tree | 9b88539a5407c6f9f1d3268412b91a0aac0ac83e /libpod | |
parent | f049cba47c31d31a4a8ed9a9180f0e847be3411c (diff) | |
download | podman-5e28cbc5fcdd89fc3623fe2324d7ba7fa6117d21.tar.gz podman-5e28cbc5fcdd89fc3623fe2324d7ba7fa6117d21.tar.bz2 podman-5e28cbc5fcdd89fc3623fe2324d7ba7fa6117d21.zip |
When running systemd in a container set container_uuid
systemd expects the container_uuid environment variable be set
when it is running in a container.
Fixes: https://github.com/containers/podman/issues/13187
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_linux.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 4d6922d73..11ca169ca 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -968,6 +968,16 @@ func (c *Container) mountNotifySocket(g generate.Generator) error { // systemd expects to have /run, /run/lock and /tmp on tmpfs // It also expects to be able to write to /sys/fs/cgroup/systemd and /var/log/journal func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) error { + var containerUUIDSet bool + for _, s := range c.config.Spec.Process.Env { + if strings.HasPrefix(s, "container_uuid=") { + containerUUIDSet = true + break + } + } + if !containerUUIDSet { + g.AddProcessEnv("container_uuid", c.ID()[:32]) + } options := []string{"rw", "rprivate", "nosuid", "nodev"} for _, dest := range []string{"/run", "/run/lock"} { if MountExists(mounts, dest) { |