diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-03-24 19:05:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 19:05:44 +0100 |
commit | e657c7a170f3ed35d56d099c5c7c15c84374c4f2 (patch) | |
tree | 0a0f013d472cf6c4ccf26b25e3be0e19b9cee8d5 /libpod | |
parent | b6c713f4d7cbf039ec2c0abcb15d2307c639b026 (diff) | |
parent | 5e28cbc5fcdd89fc3623fe2324d7ba7fa6117d21 (diff) | |
download | podman-e657c7a170f3ed35d56d099c5c7c15c84374c4f2.tar.gz podman-e657c7a170f3ed35d56d099c5c7c15c84374c4f2.tar.bz2 podman-e657c7a170f3ed35d56d099c5c7c15c84374c4f2.zip |
Merge pull request #13622 from rhatdan/systemd1
When running systemd in a container set container_uuid
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) { |